[antlr-interest] Is this code correct (V3.1) ?

Foust javafoust at gmail.com
Wed Aug 6 13:43:24 PDT 2008


Jean-Christophe,

 

I believe it would be closer to:

 

expr returns[Expr e]

@init {

Expr a, b;

e = null;

}

: ^(OR a=expr b=expr { $e = new Or($a, $b); } )

 

(Not sure about how you've defined "Expr" or "Or" - hopefully Or is a
subtype of Expr?)

 

Brent

 

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jean-Christophe Le
Lann
Sent: Wednesday, August 06, 2008 10:43 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Is this code correct (V3.1) ?

 

Hello,


I would like to know whether this code is correct in v3.1. I am using
v3.1b2.

expr returns [Expr e]
{
Expr a, b;
e = null;
}
: ^(OR a=expr b=expr { e = new Or(a, b); } )
| etc...


or do I need to use Or($a.e, $b.e) ??

In V2 that seemed to be different...Am I right ?

Thanks for your help
Jean-Christophe

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080806/2afd8ba0/attachment.html 


More information about the antlr-interest mailing list