[antlr-interest] from antrl-generated AST back to java-file?

Sinan sinan.karasu at boeing.com
Thu Feb 28 09:56:31 PST 2002


Matthew Ford wrote:
> 
> Here is a sample of what I use to output statements from a tree (after
> transforming them)
> 
> statement
> { String str,lhsStr;
>  }
> 
>  : #(as:ASSIGN_EXPR lhsStr=identOrConstant str = expression)
>   {
>    Output.out(lhsStr + " " + as.getText() + " " + str + "; //
> ASSIGN_EXPR",debug);
>   }
> 
> expression returns [String str]
> { str = "";
>  }
>  : (
>    #(EXPRESSION (str=operator | str=identOrConstant | str=just_expression) )
>   | str=operator
>   | str=identOrConstant
>   )
>  ;
 See examples/java/heteroAST 
for an xmlizedversion.

Sinan

 

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



More information about the antlr-interest mailing list