[antlr-interest] Rewrite Rules & ASTFrame
benjamin.b.lenz at daimlerchrysler.com
benjamin.b.lenz at daimlerchrysler.com
Fri Sep 7 02:21:38 PDT 2007
Hi guys,
I am using ASTFrame to visualize the generated flat tree from my parser
grammar. Now I tried to add rewrite rules to restructure the tree but there
is no difference to the AST w/o the rewrite rules. Does ASTFrame work with
rewrite rules or is there another problem? Any help would be great!
Here a snippet of the Java1.5 grammar:
grammar Java;
options {k=2; backtrack=true; memoize=true; output=AST;
ASTLabelType=CommonTree;
}
...
compilationUnit
: annotations?
packageDeclaration?
importDeclaration*
typeDeclaration*
-> ^(packageDeclaration importDeclaration typeDeclaration)
;
// Here I expected packageDeclaration to be the root of importDeclaration
and typeDeclaration //
...
packageDeclaration
: 'package' qualifiedName ';' -> ^('package' qualifiedName)
;
...
Thanks,
Ben
If you are not the intended addressee, please inform us immediately that you have received this e-mail by mistake and delete it. We thank you for your support.
More information about the antlr-interest
mailing list