[antlr-interest] joy! (tree parsing)

Terence Parr parrt at cs.usfca.edu
Tue Jun 28 14:20:22 PDT 2005


Hi,

So tree parsing error messages pretty much suck in ANTLR 2.x.  I am  
building a simple C tree parser and I got a parse error:

[program, declaration, block, stat, forStat, expr]: line 8:8  
decision=<<57:1: expr : ( ^( EQEQ expr expr ) | ^( LT expr expr ) | ^ 
( PLUS expr expr ) | atom );>> state 0 (decision=7) no viable alt;  
token=[@45,76:76='=',<16>,8:8]

I think you'll agree that this is vastly superior (even if a glut of  
info).  The point is that you have it.  It is clear to me from this  
that the expr rule encountered an ASSIGN node and didn't think it  
could parse it (true).  Do you like the stack track too? cool, eh?

Hooray!

3.0ea4 approaching...

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com



More information about the antlr-interest mailing list