[antlr-interest] Tree translation

Terence Parr parrt at cs.usfca.edu
Fri May 13 08:03:29 PDT 2005


On May 13, 2005, at 7:56 AM, Serafettin Senturk wrote:

>
>  Hello,
>
>  In my tree parser, i simply want to change the "function" keywords  
> in my
> source AST to the "method" keyword in my target AST.
>
>  For that, I have written the following code in my tree parser :
>
>  func_def!
>     :    #("function" id:IDENT id2:((elist)?) id3:stat) { #func_def  
> = #("method",
> id, id2, id3); }
>
>     ;
>
>  But it does not work, it complains like that :
>
>  java.lang.Error: Unresolved compilation problem:
>     The method add(AST) in the type ASTArray is not applicable for the
> arguments (String)

Sure.  Use #[METHOD,"method"] not "method" in the tree constructor.   
Also look at the generated code as it usually explains the issues.

See ya,
Ter




More information about the antlr-interest mailing list