[antlr-interest] joy! (tree parsing)

Prashant Deva prashant.deva at gmail.com
Mon Jul 4 20:44:18 PDT 2005


Actually you can do incremental parsing without using any parser states at all.

Its a little too complex to describe in this email. 
I will write a paper on the algorithm once i am done with Antlr Studio.

PRASHANT

---------- Forwarded message ----------
From: Terence Parr <parrt at cs.usfca.edu>
Date: Jun 29, 2005 10:24 PM
Subject: Re: [antlr-interest] joy! (tree parsing)
To: ANTLR Interest <antlr-interest at antlr.org>



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