[antlr-interest] Heterogeneous AST: returns [ Tom/Jerry]
Tobias Pape
Das.Linux at gmx.de
Fri Apr 6 02:33:13 PDT 2007
Hi me 262
Am 2007-04-06 um 03:45 schrieb me 262:
>
> expr returns [float r]
> {
> float a,b;
> r=0;
> }
> : #(PLUS a=expr b=expr) {r = a+b;}
> | #(STAR a=expr b=expr) {r = a*b;}
> | i:INT {r = atof(i->getText().c_str());}
> ;
what about:
expr returns [comic C]
: ( TOM ) => t=TOM { C=(comic)t; }
| ( JERRY ) => j=JERRY { C=(comic)j; }
;
if Tom and jerry have a common super/parent class.
hth,
-Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: Signierter Teil der Nachricht
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20070406/2c7ee258/attachment.bin
More information about the antlr-interest
mailing list