Skip to content

Instantly share code, notes, and snippets.

@pita5
Created July 3, 2012 10:04
Show Gist options
  • Save pita5/3038870 to your computer and use it in GitHub Desktop.
Save pita5/3038870 to your computer and use it in GitHub Desktop.
int stack_machine_emulator (NSString *S)
{
NSScanner* scanner = [NSScanner scannerWithString:S];
[scanner setCharactersToBeSkipped:[NSCharacterSet characterSetWithCharactersInString:@"*+"]];
NSInteger nextInt;
while ([scanner scanInteger:&nextInt])
{
NSLog(@"%d", nextInt);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment