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

Phil Ritchie endigitalmind at yahoo.co.uk
Fri Dec 2 01:46:50 PST 2005


--- Peggy Fieland <madcapmaggie at yahoo.com> wrote:

> Did you remember to initialize the AST factory when
> you run your parser?
> 
Well I didn't but even if I do I still get the same
error during pasrer.series.

All of the examples I've looked at just create a
lexer, create a parser and call the starting method.

---start parser.cs---
using antlr;
using antlr.collections;
using System;
using System.IO;
using System.Text;

namespace IntAndIDParser
{
	class Parser
	{
		[STAThread]
		static void Main(string[] args)
		{
			IntAndIDLexer lexer = new IntAndIDLexer(new
CharBuffer(Console.In));

			SeriesParser parser = new SeriesParser(lexer);

		
SeriesParser.initializeASTFactory(parser.getASTFactory());

			parser.series(); << Get error raised here!
		}
	}
}
---end parser.cs---
> 
> 
> --- 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.
> > 



		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com


More information about the antlr-interest mailing list