1 #import <Cocoa/Cocoa.h> 2 #import <antlr3.h> 3 #import "SimpleCLexer.h" 4 #import "SimpleCParser.h" 5 6 int main() { 7 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 8 9 NSString *string = [NSString stringWithContentsOfFile:@"/Users/acondit/source/antlr3/acondit_localhost/code/antlr/antlr3-main/runtime/ObjC/Framework/examples/LL-star/input"]; 10 NSLog(@"input is: %@", string); 11 ANTLRStringStream *stream = [[ANTLRStringStream alloc] initWithStringNoCopy:string]; 12 SimpleCLexer *lexer = [[SimpleCLexer alloc] initWithCharStream:stream]; 13 14 // ANTLRCommonToken *currentToken; 15 // while ((currentToken = [lexer nextToken]) && [currentToken getType] != ANTLRTokenTypeEOF) { 16 // NSLog(@"%@", [currentToken toString]); 17 // } 18 19 ANTLRCommonTokenStream *tokens = [[ANTLRCommonTokenStream alloc] initWithTokenSource:lexer]; 20 SimpleCParser *parser = [[SimpleCParser alloc] initWithTokenStream:tokens]; 21 [parser program]; 22 23 [lexer release]; 24 [stream release]; 25 [tokens release]; 26 [parser release]; 27 28 [pool release]; 29 return 0; 30 }