[antlr-interest] Odd troubles with AST generation (C++)

leviathan at mchsi.com leviathan at mchsi.com
Sat Jun 4 21:32:26 PDT 2005


I must have missed something big in the ANTLR tutorial on AST generation. When 
I use the minip or tinyc code it will compile and work fine, but when I make 
any modifications it won't. I ended up reducing my huge grammar to just this:

options {
	language="Cpp";
}

class TetraParser extends Parser;

options {
	buildAST=true;
	importVocab=TETRA;	// use vocab generated by lexer
}

program:
   ID
;

to isolate the problem, but it still occurs and I have no clue why. The error 
stems from this line when I debug:

tmp1_AST = astFactory->create(LT(1));

in TetraParser::program().

"Unhandled exception at 0x0046c741 in tc.exe: 0xC0000005: Access violation 
reading location 0x00000010."

The complete grammar works without AST construction. Can someone help me? It's 
been driving me crazy, I feel like i've missed some insignifigant error.



More information about the antlr-interest mailing list