[antlr-interest] Bug? How to get tree rewriting with patterns working in v.3.3, Charp3

Tobias Diez webmaster at altertoby.de
Sat Jul 16 15:13:55 PDT 2011


Hi,

I try to get the "tree rewriting with patterns" working in ANTLR 3.3.1.7705
(target language: CSharp 3).
I used the following code, which is a little-modified version of an example
from
http://www.antlr.org/wiki/display/~admin/2008/11/30/Example+tree+rewriting+w
ith+patterns.

tree grammar TreeWalker;

options {
    tokenVocab=Grammar;
    language=CSharp3;
    output=AST;
    ASTLabelType=CommonTree;
    filter=true;				<--- this seems to be the
problematic part!
}

topdown
    :  ^(BLOCK .*) -> ^(BLOCK)
    ;

bottomup
    :  ^(BLOCK .*) -> ^(BLOCK)
    ;


Codegeneration worked, but I get the compile error " The non-generic type
'Antlr.Runtime.Tree.TreeRewriter' cannot be used with type arguments" which
points to the following line:
public partial class TreeWalker: Antlr.Runtime.Tree.TreeRewriter<CommonTree>
So the compiler (and me, too) was unable to find a generic version of
TreeRewriter in the current Antlr3.Runtime.dll.

Any ideas?
Thanks,
Tobias



More information about the antlr-interest mailing list