during testing i noticed that my tree walker seems to be walking the tree twice
...
tree grammar t.g
prog : stat+
;
stat
@init { Console.Out.WriteLine("INTO stat"); }
@after { Console.Out.WriteLine("OUTOF stat"); }
: exprRoot
;
exprRoot
@init { Console.Out.WriteLine("INTO exprRoot"); }
@after { Console.Out.WriteLine("OUTOF exprRoot"); }
: ^(EXPR expr)
;
expr
@init { Console.Out.WriteLine("INTO expr"); }
@after { Console.Out.WriteLine("OUTOF expr"); }
: ID
| call
;
call
@init { Console.Out.WriteLine("INTO call"); }
@after { Console.Out.WriteLine("OUTOF call"); }
: ^(CALL ID exprList?)
{
Console.Out.WriteLine("--------in call");
}
;
exprList
: ^(EXPRLIST .*)
| EXPRLIST
;
my program is just one statement, one function call
input:
myfunc(x);
trace:
INTO stat
INTO exprRoot
INTO expr
INTO call
INTO expr
OUTOF expr
-------------in call myfunc
OUTOF call
OUTOF expr
OUTOF exprRoot
OUTOF stat
and then it does it again ...
INTO stat
INTO exprRoot
INTO expr
INTO call
INTO expr
OUTOF expr
-------------in call myfunc
OUTOF call
OUTOF expr
OUTOF exprRoot
OUTOF stat
anyone spot a grammar problem?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address