1#import <Cocoa/Cocoa.h> 2#import <antlr3.h> 3#import "SymbolTableLexer.h" 4#import "SymbolTableParser.h" 5 6int 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/scopes/input"]; 10 NSLog(@"input is : %@", string); 11 ANTLRStringStream *stream = [[ANTLRStringStream alloc] initWithStringNoCopy:string]; 12 SymbolTableLexer *lexer = [[SymbolTableLexer alloc] initWithCharStream:stream]; 13 14// ANTLRCommonToken *currentToken; 15// while ((currentToken = [lexer nextToken]) && [currentToken getType] != ANTLRTokenTypeEOF) { 16// NSLog(@"%@", currentToken); 17// } 18 19 ANTLRCommonTokenStream *tokens = [[ANTLRCommonTokenStream alloc] initWithTokenSource:lexer]; 20 SymbolTableParser *parser = [[SymbolTableParser alloc] initWithTokenStream:tokens]; 21 [parser prog]; 22 23 [lexer release]; 24 [stream release]; 25 [tokens release]; 26 [parser release]; 27 28 [pool release]; 29 return 0; 30}