0

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.

rds
  • 26,253
  • 19
  • 107
  • 134
Ramesh
  • 765
  • 7
  • 24
  • 52
  • You need to post more code, probably there maybe spelling or case issue. – Pradeep Simha Mar 01 '13 at 17:21
  • Go ahead and post your code..That would make sense for us to find out the cause of error.. – Vishal K Mar 01 '13 at 17:30
  • Maybe this will help; `class pcat.CUP$PcatParser$actions` is a nested class definition. pcat.CUP contains the PCatParser class and PCatParser contains the actions class. – DwB Mar 01 '13 at 17:32
  • I am not sure if I understand that. What should I update to resolve this error? I tried removing the package statement but it did not work. – Ramesh Mar 01 '13 at 17:37

0 Answers0