I am trying to run an example provided by CUP: Parsing directly to XML.
I stored the 'Minijava Grammar' in a file named minijava.cup and the scanner into a file named xml.flex. I ran JFlex to obtain Lexer.java from the xml.flex file. After that I obtained Parser.java and sym.java after running the command specified on the CUP example:
java -jar java-cup-11b.jar -locations -interface -parser Parser -xmlactions minijava.cup
My directory looks like this:
input.xml
java-cup-11b.jar
java-cup-11b-runtime.jar
jflex-1.6.1.jar
Lexer.java
minyjava.cup
Parser.java
sym.java
xml.flex
I am trying to compile the Lexer.java file by using the following command:
javac -cp java-cup-11b-runtime.jar Lexer.java
but I get 47 errrors in the format "..cannot find symbol...". The first ones specify that classes sym and minijava.Constants can't be found.
Lexer.java:17: error: cannot find symbol
public class Lexer implements java_cup.runtime.Scanner, sym, minijava.Constants{
^ symbol: class sym
Lexer.java:17: error: package minijava does not exist
public class Lexer implements java_cup.runtime.Scanner, sym, minijava.Constants {
^ Lexer.java:679: error: cannot find symbol
{return symbolFactory.newSymbol("EOF", EOF, new Location(yyline+ 1,yycolumn+1,yychar), new Location(yyline+1,yycolumn+1,yychar+1));
I do not understand why the sym.java file is not visible to Lexer or where to get the minijava.Constants file.