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