[antlr-interest] joy! (tree parsing)

Terence Parr parrt at cs.usfca.edu
Wed Jun 29 09:54:50 PDT 2005


On Jun 29, 2005, at 2:31 AM, Sebastian Mies wrote:

> Hi Terence,
>
> TP> So tree parsing error messages pretty much suck in ANTLR 2.x. I am
> TP> building a simple C tree parser and I got a parse error:
>
> TP> [program, declaration, block, stat, forStat, expr]: line 8:8
> TP> decision=<<57:1: expr : ( ^( EQEQ expr expr ) | ^( LT expr  
> expr ) | ^
> TP> ( PLUS expr expr ) | atom );>> state 0 (decision=7) no viable alt;
> TP> token=[@45,76:76='=',<16>,8:8]
> Nice!! :-)
> So, if the stack track is available - next step whould be a
> incremental parsing engine? at least it would be nice to save the
> parser/lexer state at certain positions to restart parsing from
> there until it matches another saved state.
> Thats not incremental parsing in the common sense, but it would be
> enough for most cases.

Hi :)  Well, I sort of cheat by asking the Java runtime for the stack  
trace.  I will look at incremental parsing in the future for sure.   
Maybe I can convince Dave Ewing at apple to educate me on the subject :)

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