[antlr-interest] If statement for Tree-based Interpreter: is itthe correct way to do it?

Hill, Robert rhill03 at eds.com
Fri Aug 24 04:57:45 PDT 2007


D'Oh. Ok, I should have looked at that page *before* posting!..

"The wildcard says skip the entire subtree (new in 3.0b6)."

Sorry for the static!

Cheers!

Rob


Robert Hill
Information Analyst (C/C++,C#,.NET,Java)
Agile Alliance Member
UKIMEA Technical Capabilities ADU
UKIMEA RABU
Application Services Field Operations EMEA

Hallamshire Business Park, 100 Napier St, Sheffield. S11 8HD
email:	rhill03 at eds.com
Office:	+44 114 291 1928
Mobile:	+44 7903 185 516

This email contains information which is confidential and may be
privileged. Unless you are the intended addressee (or authorised to
receive for the addressee) you may not use, forward, copy or disclose to
anyone this email or any information contained in this email. If you
have received this email in error, please advise the sender by reply
email immediately and delete this email.

Electronic Data Systems Ltd
Registered Office:, Lansdowne House, Berkeley Square, London  W1J 6ER 
Registered in England no: 53419
VAT number: 432 99 5915


 

>-----Original Message-----
>From: antlr-interest-bounces at antlr.org 
>[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Terence Parr
>Sent: 23 August 2007 19:32
>To: antlr-interest Interest
>Subject: Re: [antlr-interest] If statement for Tree-based 
>Interpreter: is itthe correct way to do it?
>
>
>On Aug 23, 2007, at 11:02 AM, Pavel Ganelin wrote:
>
>>
>> Hi,
>>
>> I found that in ANTLR v3 it is more difficult to skip the child for 
>> tree walker compare with v2. Is it true or it is just learning curve?
>>
>> Below I attached how I process if statement for a tree-based 
>> interpreter. Please note that I had to add artificial token 
>EOL while 
>> building the tree in the parser so that I could position the cursor 
>> just before Token.UP. I did not find a way to move the 
>pointer to the 
>> last node of the the given tree ($s in the example below). Start and 
>> Stop indexes in the tree node point to the original token tree, not 
>> the CommonTreeNodeStream.
>>
>> Is it the way it is supposed to be implemented? If not what is the 
>> correct approach
>>
>> PS. I did read  http://www.antlr.org/wiki/display/ANTLR3/Simple
>> +tree-based+interpeter. It does not cover this question.
>
>Hi Pavel,
>
> From that page:
>
>^(FUNC name=ID arg=ID .)
>
>The dot skips the body subtree :)
>
>Ter
>


More information about the antlr-interest mailing list