string_decl_list : (string_decl)+;
string_decl : ('STRING' id ':=' str ';')
{//table.currentScope().define(new BaseDescriptor(), id.text, ValueType.STRING);
System.out.println($str.text);
};
str : STRINGLITERAL;
My grammar looks like this. The compilation is fine. But when I try to parse my file.
There's an exception coming out.
Exception in thread "main" java.lang.NoSuchFieldError: str
at MicroParser.string_decl(MicroParser.java:368)
at MicroParser.string_decl_list(MicroParser.java:312)
at MicroParser.decl(MicroParser.java:246)
at MicroParser.pgm_body(MicroParser.java:187)
at MicroParser.program(MicroParser.java:107)
at Compiler.main(Compiler.java:32)
Java Result: 1
I guess I am doing it right for the rule reference, could anyone help me about this? I don't know how to solve it