[antlr-interest] Bug in C# Tree Parser generator ?
Michel Metzger
metzgerm at iro.umontreal.ca
Sat Mar 19 15:02:26 PST 2005
Hi,
First of all, thank you very much for this wonderful tool !
I'm using Antlr to build and transform an AST of linear temporal logic
formulae (but that's a detail).
I observed a strange behavior for the following transformation rule :
|! (#(OP_NOT OP_UNT)) => #(OP_NOT #(OP_UNT leftNU:expr rightNU:expr))
{
#expr = #([OP_REL, "R"], #([OP_NOT, "!"], leftNU), #([OP_NOT,
"!"], rightNU));
}
| #(OP_NOT expr)
The generated code for the subtree creation (line 2) is:
expr_AST = (AST) astFactory.make(astFactory.create(OP_REL,"R"),
(AST) astFactory.make(astFactory.create(tmp12_AST,"!"), leftNU_AST),
(AST) astFactory.make(astFactory.create(tmp12_AST,"!"), rightNU_AST));
The problem is the transformation from [OP_NOT, "!"] to
astFactory.create(tmp12_AST,"!"). I don't understand
why it didn't produce astFactory.create(OP_NOT,"!"). For now, the only
workaround I found is to write directly the int code of my token OP_NOT
ie. [12, "!"].
Is there something wrong in my code ? or is it a bug ?
I can send the VS project to the maintainer of the C# generator if it
can help. I use Antlr 2.7.5, VS 2003 and .NET 1.1
Thank you,
Michel.
More information about the antlr-interest
mailing list