2

I'm trying to implement a parser with JFlex and Cup. Right now I'm just trying to get them to compile the simple example program found at the link below.

http://www.cs.rit.edu/~pal6640/cup-example/simple-expr.html

To create the parser.java and sym.java file from the cup script I run:

java –jar java-cup-11a.jar parser.cup

Next, I use JFlex.jar to create the lexer java file:

java –jar JFlex.jar lexer.lex

Then to compile:

javac –classpath java-cup-11a.jar Yylex.java sym.java parser.java

The compile command throws 12 errors. They all say

cannot find the symbol variable scanner

I think that I have all my environment variables set correctly. Does anyone know what I'm doing wrong?

nbro
  • 15,395
  • 32
  • 113
  • 196
Ryan
  • 43
  • 1
  • 6

1 Answers1

1

Java CUP distributes two jar files: executable standalone Jar-package and CUP runtime-library to use in conjunction with CUP generated parsers. The parser generated by CUP needs the second one. Therefore your third command should be something like

javac –classpath java-cup-11a-runtime.jar Yylex.java sym.java parser.java
Romildo
  • 545
  • 9
  • 20