[antlr-interest] yet more thoughts on error handling / recovery

Terence Parr parrt at cs.usfca.edu
Tue Jun 29 14:05:06 PDT 2004


On Jun 28, 2004, at 9:19 PM, Monty Zukowski wrote:

>>
>> Rather than print the grammar out as a string for use by the error
>> reporting, perhaps the entire tree structure (i.e., the processed
>> grammar) should be made available to the running parser. The grammar
>> position would map to an actual AST node. The cost would be a slightly
>> larger string (flattened AST as string) compared to the original
>> grammar, but would potentially provide more grammar information to a
>> reporting facility. Hmm...actually, since the trees have down/right
>> pointers (not up/left) it would be hard to walk backwards to print out
>> a larger portion of the grammar. Ok, forget that.
>
> It's not _that_ big a deal to implement up/left pointers.  See my GCC
> grammar :)  Just jump up to the enclosing alt and you're set.

Doing in a general way for arbitrary tree construction when you have 
actions involved can be tricky ;)

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list