[antlr-interest] Rewrite Problem; Rule terminates without exception.
Michael Ernst
chiptv at web.de
Sun Mar 16 08:09:55 PDT 2008
Hi,
I think that's exactly what I have done (previous sample).
expression
: ...
| (orExpression ADDITION_ASSIGNMENT) => a=orExpression
ADDITION_ASSIGNMENT expression -> ^(ASSIGNMENT $a ^(PLUS $a expression))
...
Parsing "a += b;" results in following AST: (ASSIGNMENT a (PLUS b))
I get the following warning during debugging:
[org.antlr.works.debugger.tree.DBASTModel - event 1604] Warning: [addChild]
Child node 97 not found, ignoring.
Thanks for your help.
Regards
Michael
-----
At 01:57 17/03/2008, Michael Ernst wrote:
>When I rewrite the tree and referencing the label twice, I get
>no tree duplicate attached to the tree. I thought I could
>duplicate nodes and trees by referencing them more than one
>time in a rewrite rule (Chapter 7; Duplicating Nodes and
>Trees (sample: dump : INT -> INT INT ;)).
I think you have to give them explicit labels when duplicating,
otherwise it assumes you're referring to separate instances. So
this should work:
dump : a=INT -> $a $a;
More information about the antlr-interest
mailing list