I am designing a compiler for a small programming language. We are given a java pre processor (GEN package) which generates the ASTs needed for the compilers. We have to just give the input grammar in a specific format to the GEN file. The GEN file will auto generate the java class file. My GEN file is getting compiled correctly. However, the generated JAVA class file has the following error no matter what I change in the GEN code.
PcatParser.java:1022: cannot find symbol
symbol : class trees
location: class pcat.CUP$PcatParser$actions
I searched for this error and found that it is related to some wrong package being used or variable not declared. However, in my case the error is getting during run time. I am not sure on what is going wrong here.
/********************************************************************************
*
* File: pcat.gen
* The PCAT parser
*
********************************************************************************/
package pcat;
import Gen.*;
import java_cup.runtime.*;
parser code {:
//Terminal and non terminal declarations for the grammar
start with program;
program ::= PROGRAM IS body:b SEMI
{: PcatParser.program_AST = #<ProcDecs(ProcDec(main,NoTyp(),`b))>; :}
;
The PcatParser.program_AST generates the PcatParser.java class file. The #< > syntax is used to generate the ASTs for the specified input.