[antlr-interest] What tool[s] do you use when debugging ANTLR grammars?

Bogdan Mitu bogdan_mt at yahoo.com
Fri Jun 21 00:42:09 PDT 2002

Hi Micheal,

As Loring pointed out, you should avoid "debugging". I recommand you to
refrain from writing a complete lexer, than a complete parser, and in the
end trying to figure out what is going wrong. Use small steps instead.

For instance, if you want to write a grammar for a Java-like language, you
can start with a lexer and a parser that recognize only imports. Test it
with several examples. Than add rules to recognize classes with empty
bodies. Test it again ... and continue like this until you parse the
complete language. The lexer and the parser will grow step by step, and they
will be valid at any stage.

Using this incremental approach, if you get an error or an ambiguity, you
know for sure where they come from: the new rule you just wrote.


--- micheal_jor <open.zone at virgin.net> wrote:
> Following on from my grammar debugging issues and recent ParseView 
> post, I'd like to know what tools others rely on for debugging 
> grammars.
> I've re-written my grammar many times already due to a number of 
> seemingly intractable warnings/errors. I am just about to rewrite 
> again but this time I am starting off by designing an heterogenous 
> AST structure and working my way back from that to the grammar.
> So what tools do you use for grammar debugging and, what tips can you 
> offer an ANTLR newbie on grammar creation and debugging?
> Micheal
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list