[antlr-interest] Switching buildAST to true causes "Invalid AST node type" error.

Peggy Fieland madcapmaggie at yahoo.com
Thu Dec 1 12:47:51 PST 2005


Did you remember to initialize the AST factory when
you run your parser?



--- Phil Ritchie <endigitalmind at yahoo.co.uk> wrote:

> The grammar below generates classes that build and
> run
> fine if buildAST is set to false. As soon as I set
> it
> to true (without changing anything else) my parser
> raises an "Invalid AST node type" error. I'm not
> trying to traverse the AST, just build it. Can
> anyone
> tell me what I'm doing wrong.
> 
> ---start grammar---
> options
> {
> 	language = "CSharp";
> }
> 
> class IntAndIDLexer extends Lexer;
> 
> INT		: ('0'..'9')+ ;
> 
> ID		: ('a'..'z')+ ;
> 
> COMMA	: ',' ;
> 
> 
> class SeriesParser extends Parser;
> options
> {
> 	buildAST = true;
> }
> 
> series	: element (COMMA element)* ;
> 
> element
> 	:	a:INT	{System.Console.WriteLine(a.getText());}
> 	|	b:ID	{System.Console.WriteLine(b.getText());}
> 	;
> ---end grammar---
> 
> 
> 		
>
___________________________________________________________
> 
> Yahoo! Model Search 2005 - Find the next catwalk
> superstars -
> http://uk.news.yahoo.com/hot/model-search/
> 



More information about the antlr-interest mailing list