[antlr-interest] Incremental TreeWalker (was: What's the SLK Parser Generator?)

mrosgood mrosgood at yahoo.com
Wed Oct 16 12:13:36 PDT 2002


Hi Monty Zukowski-


Thanks for the reply!  I'm glad the ANTLR intelligentsia are thinking
about this stuff. <grin>

> Cook & Welsh's approach is kinda hacky too in that they 
> assume you want to work with a parse tree and not an AST.  
> ...

I agree; I'd rather just see the AST.

Cook and Welsh's innovation is efficiently handling substreams of
input which are temporarily syntactically incorrect.  That's why they
retain the parse tree.  There might be other solutions.

> For instance in java you could make an entry point into 
> the java grammar to recognize methods.  As they edit the 
> method just keep running that rule and replacing the AST 
> and updating the symbol table.

Are you suggesting parser support for incremental treewalkers? <grin>
 If so, I second the idea.

> Note that you can't just call the existing method rule 
> because antlr "knows" that that rule is never called by 
> itself, only from other rules.  Create a new rule that 
> calls method follwed by EOF and you won't have any 
> problems with the follow set.

Yea, that'd probably work for procedural languages.  However, my
Giraffe language is basically an annotated tree.  A serialized version
of a Swing object graph.  No methods.  Think RELAX-NG's structure
meets VRML syntax.  (And almost completely unlike XUL, Bean Markup
Language, XMLEncode/Decode, etc.)

But wouldn't it be great if we could use our grammars as-is?  A
generalized approach would have the most benefit.

I decided to get smart about this stuff.  In fact, I finally learned
the difference between LR and LL.  Woohoo!  Because I started with
ANTLR and was spared the Lex/Yacc experience, I have to now admit that
I didn't fully appreciate how grateful I was supposed to be.

I'm working through the incremental papers I've collected, trying to
grok the algorithms.  Maybe the ideas can be repurposed for ANTLR.  As
you noted, ANTLR gnerated rules can't be invoked "from the outside". 
So maybe ANTLR can be tweaked so that rules can accept parser state.

I'll also be on the lookout for incremental treewalker ideas.  In
terms of my Giraffe language, having Swing buttons and panels flash in
and out of existance as the AST changed would be boss.


Cheers, Jason Osgood


 

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



More information about the antlr-interest mailing list