[antlr-interest] Antlr v2 AST -> v3 AST
Sam Harwell
sharwell at pixelminegames.com
Mon Nov 24 09:47:05 PST 2008
That's almost correct. The direct translation would be this:
logical_literal : 'false' -> LOGICAL_LITERAL[] ;
However, many v2 AST construction rules follow this pattern with a
setLine/setColumn pair, in which case, the following would be better.
There are other advantages to this method as well:
logical_literal
: value='false'
-> LOGICAL_LITERAL[$value]
;
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of chain one
Sent: Monday, November 24, 2008 6:33 AM
To: antlr-interest
Subject: [antlr-interest] Antlr v2 AST -> v3 AST
Sorry for the wide distribution, I am newbie to ANTLR.
I found a V2 AST rule.
logical_literal
: 'false' { $logical_literal = $([LOGICAL_LITERAL,
'LOGICAL_LITERAL'], $logical_literal); };
Is it correct to translate this rule to the following RULE in V3?
logical_literal
: 'false' ->
^(LOGICAL_LITERAL[],$logical_literal);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081124/825771af/attachment.html
More information about the antlr-interest
mailing list