diff options
Diffstat (limited to 'runtime/ObjC/Framework/examples/LL-star/main.m')
-rw-r--r-- | runtime/ObjC/Framework/examples/LL-star/main.m | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/runtime/ObjC/Framework/examples/LL-star/main.m b/runtime/ObjC/Framework/examples/LL-star/main.m new file mode 100644 index 0000000..0a645be --- /dev/null +++ b/runtime/ObjC/Framework/examples/LL-star/main.m @@ -0,0 +1,30 @@ +#import <Cocoa/Cocoa.h> +#import <antlr3.h> +#import "SimpleCLexer.h" +#import "SimpleCParser.h" + +int main() { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + NSString *string = [NSString stringWithContentsOfFile:@"/Users/acondit/source/antlr3/acondit_localhost/code/antlr/antlr3-main/runtime/ObjC/Framework/examples/LL-star/input"]; + NSLog(@"input is: %@", string); + ANTLRStringStream *stream = [[ANTLRStringStream alloc] initWithStringNoCopy:string]; + SimpleCLexer *lexer = [[SimpleCLexer alloc] initWithCharStream:stream]; + +// ANTLRCommonToken *currentToken; +// while ((currentToken = [lexer nextToken]) && [currentToken getType] != ANTLRTokenTypeEOF) { +// NSLog(@"%@", [currentToken toString]); +// } + + ANTLRCommonTokenStream *tokens = [[ANTLRCommonTokenStream alloc] initWithTokenSource:lexer]; + SimpleCParser *parser = [[SimpleCParser alloc] initWithTokenStream:tokens]; + [parser program]; + + [lexer release]; + [stream release]; + [tokens release]; + [parser release]; + + [pool release]; + return 0; +}
\ No newline at end of file |