How can I solute this problem?
I am developping a compiler for a VB-like language, and I use ANTLR2.7.7
to generate my AST builder, but now I have a problem when create tree
node for this production:
varDecl
: "Dim" identList "As" type
;
identList
: IDENT (LPAREN INTLIT RPAREN)? (COMMA IDENT (LPAREN INTLIT RPAREN)? )*
;
I want to create respective tree node for a single variable and an array
variable,but the problem is both of their first set contain the token
IDENT which mean an identifier:
varDecl!
options {defaultErrorHandler = true;} // let ANTLR handle errors
: d:"Dim" idl:identList "As"! t:type
{
#varDecl = #(#[VARDEF,"VARDEF"], t, idl);
}
;
identList
: id:IDENT //a tree node has add to tree
(lb:LPAREN^ /*now I want to create a ARRAY_DEF note instand of a single
variable tree node*/ INTLIT RPAREN!)?
(COMMA! IDENT (lb:LPAREN INTLIT RPAREN)? )*
;
And how do I solute this problem?
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.