[antlr-interest] Tree rewrite rule problem
Juancarlo Añez
apalala at gmail.com
Tue Sep 25 07:37:09 PDT 2012
NIlo,
For me, tree rewriting works in mysterious ways...
Replace the $i1 by ID and everything should be fine.
At other times when you need help with disambiguation, create "dummy" rules
that you can reference from within other rules:
expre: .... ;
expre1: expre;
-- Juanca
On Mon, Sep 24, 2012 at 10:18 PM, Nilo Roberto C Paim <nilopaim at gmail.com>wrote:
> Hi, all.
>
>
>
> I have the following rule on my grammar:
>
>
>
> expr
>
> :
>
> i1=ID
>
> (
>
> compOp boolOp
>
> ->
>
> ^(BOOLEXPR $i1 compOp boolOp)
>
> | (NOT)? NUMERIC
>
> ->
>
> ^(BOOLEXPR $i1 NOT? NUMERIC)
>
> |
>
> ->
>
> ^(BOOLEXPR $i1)
>
> )
>
> ;
>
>
>
> Problem: the parsing is done correctly, but the resulting tree contains
> only the imaginary node BOOLEXPR, with no children. If I put a
> System.out.println as action for the alternatives, It shows me correctly,
> but anyway, the tree is corrupt.
>
>
>
> Any hints?
>
>
>
> TIA.
>
>
>
> Nilo - Brazil
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
--
Juancarlo *Añez*
More information about the antlr-interest
mailing list