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

Monty Zukowski monty at codetransform.com
Tue Jun 29 16:29:32 PDT 2004


On Jun 29, 2004, at 3:21 PM, Terence Parr wrote:

> On Jun 29, 2004, at 2:45 PM, micheal_jor wrote:
>
>> --- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> 
>> wrote:
>>>> 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 ;)
>>
>> Not sure I agree. In one of my projects I found that most of the
>> issues {with tree-construction/tree-parsing} can be resolved with a
>> custom ASTFactory that understands that the custom ASTNode class had
>> parent/previousSibling links too.
>>
>> I seem to remember needing a addChildEx() method. Can't quite remember
>> if this was due to a shortcoming in the ASTFactory model or was just
>> to keep some legacy code - that used addChild() - tickling along fine.
>
> Roger that.  I'll keep this in mind.

Yeah, or like in the C grammar you don't even set parent/previous until 
the tree is complete, then you fire through the tree and set them in 
one pass.

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html



 
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