[antlr-interest] AST construction problem
Damir Kirasić
Damir.Kirasic at fer.hr
Mon Jul 16 23:56:22 PDT 2007
Hello,
I am new to ANTLR.
I am trying to construct an AST for C
with the following C grammar:
translation_unit
scope Symbols;
@init {
$Symbols::types = new Hashtable();
}
: external_declaration+ -> ^(translation_unit external_declaration+)
;
... // other rules
but I get
"error(136): C.g:87:31: reference to rewrite element translation_unit
without reference on left of ->"
It works fine if I define translationUnit as a token
and then use rewrite rule:
-> ^(translationUnit external_declaration+)
Can I do that without defining translationUnit as a token
and use rule name translation_unit instead?
Thank you for your answers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070717/07c9cc26/attachment.html
More information about the antlr-interest
mailing list