1#import <Foundation/Foundation.h>
2#import <ANTLR/ANTLR.h>
3#import "SimpleCLexer.h"
4#import "SimpleCParser.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/LL-star/input" encoding:NSASCIIStringEncoding error:&error];
12	NSLog(@"input is: %@", string);
13	ANTLRStringStream *stream = [[ANTLRStringStream alloc] initWithStringNoCopy:string];
14	SimpleCLexer *lexer = [[SimpleCLexer alloc] initWithCharStream:stream];
15
16//	CommonToken *currentToken;
17//	while ((currentToken = [lexer nextToken]) && currentToken.type != TokenTypeEOF) {
18//		NSLog(@"%@", [currentToken toString]);
19//	}
20
21	CommonTokenStream *tokens = [[CommonTokenStream alloc] initWithTokenSource:lexer];
22	SimpleCParser *parser = [[SimpleCParser alloc] initWithTokenStream:tokens];
23	[parser program];
24
25	[lexer release];
26	[stream release];
27	[tokens release];
28	[parser release];
29
30	[pool release];
31	return 0;
32}