1#import <Foundation/Foundation.h> 2#import <ANTLR/ANTLR.h> 3#import "SymbolTableLexer.h" 4#import "SymbolTableParser.h" 5 6int main() 7{ 8 NSError *error; 9 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 10 11 NSString *string = [NSString stringWithContentsOfFile:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/scopes/input" encoding:NSASCIIStringEncoding error:&error]; 12 NSLog(@"input is : %@", string); 13 ANTLRStringStream *stream = [[ANTLRStringStream alloc] initWithStringNoCopy:string]; 14 SymbolTableLexer *lexer = [[SymbolTableLexer alloc] initWithCharStream:stream]; 15 16// CommonToken *currentToken; 17// while ((currentToken = [lexer nextToken]) && currentToken.type != TokenTypeEOF) { 18// NSLog(@"%@", currentToken); 19// } 20 21 CommonTokenStream *tokens = [[CommonTokenStream alloc] initWithTokenSource:lexer]; 22 SymbolTableParser *parser = [[SymbolTableParser alloc] initWithTokenStream:tokens]; 23 [parser prog]; 24 25 [lexer release]; 26 [stream release]; 27 [tokens release]; 28 [parser release]; 29 30 [pool release]; 31 return 0; 32}