[antlr-interest] AST rewrite bug C# target
Sam Harwell
sharwell at pixelminegames.com
Fri May 8 12:03:42 PDT 2009
You should always reference rule arguments and return values with a $,
as in $ids. I'm thinking about making a mode that mangles the names of
items that aren't meant to be accessed directly, which is required for
some optimization work I've been planning.
Sam
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Floris van Nee
Sent: Friday, May 08, 2009 1:18 PM
To: ANTLR
Subject: [antlr-interest] AST rewrite bug C# target
Hi all,
I think I've come across another bug in the C# target when rewriting
ASTs in tree grammars.
I have included two files needed to reproduce the bug. The behaviour is
this:
It happens when a tree grammar is created with rules which return
values, like:
qualifier returns [List<string> ids]
: ^(fqual=FQUALIFIER IDENTIFIER+ ARRAY?)
{
ids = new List<String>() { "System",
"Void" };
}
;
The C# compiler complains about the variable ids which it cannot find.
Also, when you reference the return value of such a rule somewhere, as
in qual=qualifier, you will have a variable qual with type
qualifier_return, instead of List<string>.
I guess this is a bug in the C# target of ANTLR - but if it's not, what
should I do to make the code compile correctly?
I am using the latest version of ANTLR (3.1.3)
Thanks,
Floris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090508/7590d31d/attachment.html
More information about the antlr-interest
mailing list