[antlr-interest] Help debugging Tree Grammar

Rune Glerup rug at maconomy.com
Fri May 7 09:52:26 PDT 2010


Hi

I have a tree grammar rule for the purpose of rewriting this pattern:

something or false     => something
something or true      => true
false     or something => something
true      or something => true

The rule looks like this:

orRewrite : ^(n=OR . . {binaryOperatorHasValueOperand($n)}?) -> {
  rewriteOrExpression($n)
} ;

It seems however that ^(OR . .) does not match this AST (printed with
toStringTree()):

(or (CALL fun ARGS) true)

It is a bit hard to actually find out what is going on inside the
runtime other than match() gets the token EOF at a time, when it expects
UP.

Am I doing something obvious wrong?

Thanks!

-- 
Rune




More information about the antlr-interest mailing list