1#import <Foundation/Foundation.h>
2#import <ANTLR/ANTLR.h>
3#import "TreeRewriteLexer.h"
4#import "TreeRewriteParser.h"
5//#import "stdio.h"
6//#include <unistd.h>
7
8int main() {
9	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
10
11	ANTLRStringStream *stream = [ANTLRStringStream newANTLRStringStream:@"23 42"];
12	TreeRewriteLexer *lexer = [TreeRewriteLexer newTreeRewriteLexerWithCharStream:stream];
13
14//    id<Token> currentToken;
15//    while ((currentToken = [lexer nextToken]) && [currentToken type] != TokenTypeEOF) {
16//        NSLog(@"%@", currentToken);
17//    }
18
19	CommonTokenStream *tokenStream = [CommonTokenStream newCommonTokenStreamWithTokenSource:lexer];
20	TreeRewriteParser *parser = [[TreeRewriteParser alloc] initWithTokenStream:tokenStream];
21	CommonTree *rule_tree = [[parser rule] getTree];
22	NSLog(@"tree: %@", [rule_tree treeDescription]);
23//	CommonTreeNodeStream *treeStream = [[CommonTreeNodeStream alloc] initWithTree:program_tree];
24//	SimpleCTP *walker = [[SimpleCTP alloc] initWithTreeNodeStream:treeStream];
25//	[walker program];
26
27	[lexer release];
28	[stream release];
29	[tokenStream release];
30	[parser release];
31//	[treeStream release];
32//	[walker release];
33
34	[pool release];
35    // sleep for objectalloc
36    // while(1) sleep(60);
37	return 0;
38}