[antlr-interest] C# generator, tree & bug report

Lloyd Dupont lloyd at galador.net
Mon Sep 2 08:27:30 PDT 2002


Hi folks !

I was using ANTLR to write a little code generator.
C# is the natural language of my programs.
So I though a C# Parser would be more powerfullto do some of my app specific
stuff.
I also use customized AST tree construction in my parser.
something like :
args
 :(
     ! LPAR RPAR { #args = #[VOID]; }
     |! (LPAR VOID RPAR)=> LPAR VOID RPAR { #args = #[VOID]; }
     | LPAR! argList RPAR!
    )
 { #args = #([PARAMS, "args"], #args); }
    ;
but I have some trouble with this contruction semantic:
"#args = #[VOID];"

as it generate:
args_AST = (AST)astFactory.create(VOID);
whereas it should generate (in C#, as it is correct in Java)
args_AST = (AST)astFactory.create(MyTokenTypes.VOID);

mmhh..
that's very curious.
I use this syntax more than once, but it write this uncorrect output only
once.
my grammar file is relatively short, I could send it to whoever is
interested, if needed....

cheers,
Lloyd


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list