Hi All,
My grammar results in the error:
Decision can match input such as "'component' ID '{' '}'" using multiple
alternatives: 1, 2.
I know the problem, but just am not sure of the best way to fix this.
Ultimately, I'm trying to construct the AST with type information in the
tree nodes, and the type information comes from my java class SymbolTable.
How can I fix this and still get the type info from my SymbolTable class?
Grammar:
elementDef : componentDef | interfaceDef ;
componentDef : ( type ID '{' interfaceRef* '}' ) -> ^(type ID
interfaceRef*);
interfaceDef : ( type ID '{' messageDef* '}' ) -> ^(type ID messageDef*);
type returns [Type t]
: 'component' { $t = (Type)m_symbolTable.resolve("component"); }
| 'interface' { $t = (Type)m_symbolTable.resolve("interface"); }
| 'message' { $t = (Type)m_symbolTable.resolve("message"); } ;
Thanks
Bill
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.