Question

I am beginner of JFlex. I am working on Ubuntu and have installed Java as well as JFlex. Both java as well as jflex command are working means PATH variables are set properly. when I run my jflex file, it runs w/o error but while running .java file it gives bunch of errors regarding sym. My execution lines are as below...

jflex abc.jflex
javac -cp java-cup-0.11a.jar PascalLexer.java 

The errors are as below:

pratik@pratik-Lenovo-G550:~/myFlex$ javac -cp java-cup-0.11a.jar PascalLexer.java 
PascalLexer.java:663: error: cannot find symbol
          { return newSym(sym.TYPE);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:667: error: cannot find symbol
          { return newSym(sym.REAL, new Double(yytext()));
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:671: error: cannot find symbol
          { return newSym(sym.GTR);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:675: error: cannot find symbol
          { return newSym(sym.ASSMNT);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:679: error: cannot find symbol
          { return newSym(sym.ELSE);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:683: error: cannot find symbol
          { return newSym(sym.THEN);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:687: error: cannot find symbol
          { return newSym(sym.VAR);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:691: error: cannot find symbol
          { return newSym(sym.IDENT, yytext());
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:695: error: cannot find symbol
          { return newSym(sym.MINUS);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:699: error: cannot find symbol
          { return newSym(sym.SEMI);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:703: error: cannot find symbol
          { return newSym(sym.NOT_EQ);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:711: error: cannot find symbol
          { return newSym(sym.COMMA);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:715: error: cannot find symbol
          { return newSym(sym.IF);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:719: error: cannot find symbol
          { return newSym(sym.RT_PAREN);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:723: error: cannot find symbol
          { return newSym(sym.OR);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:727: error: cannot find symbol
          { return newSym(sym.EQ);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:731: error: cannot find symbol
          { return newSym(sym.RT_BRKT);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:735: error: cannot find symbol
          { return newSym(sym.DIVIDE);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:739: error: cannot find symbol
          { return newSym(sym.DOT);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:743: error: cannot find symbol
          { return newSym(sym.PROCEDURE);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:747: error: cannot find symbol
          { return newSym(sym.CHAR, new Character(yytext().charAt(1)));
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:751: error: cannot find symbol
          { return newSym(sym.LEFT_PAREN);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:755: error: cannot find symbol
          { return newSym(sym.BEGIN);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:759: error: cannot find symbol
          { return newSym(sym.END);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:763: error: cannot find symbol
          { return newSym(sym.GTR_EQ);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:767: error: cannot find symbol
          { return newSym(sym.PROGRAM);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:771: error: cannot find symbol
          { return newSym(sym.AND);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:775: error: cannot find symbol
          { return newSym(sym.ARRAY);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:779: error: cannot find symbol
          { return newSym(sym.LESS_EQ);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:783: error: cannot find symbol
          { return newSym(sym.OF);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:787: error: cannot find symbol
          { return newSym(sym.INT, new Integer(yytext()));
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:796: error: cannot find symbol
          { return newSym(sym.PLUS);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:800: error: cannot find symbol
          { return newSym(sym.LEFT_BRKT);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:804: error: cannot find symbol
          { return newSym(sym.LESS);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:813: error: cannot find symbol
          { return newSym(sym.TIMES);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:817: error: cannot find symbol
          { return newSym(sym.COLON);
                          ^
  symbol:   variable sym
  location: class PascalLexer
PascalLexer.java:824: error: cannot find symbol
              { return new java_cup.runtime.Symbol(sym.EOF); }
                                                   ^
  symbol:   variable sym
  location: class PascalLexer
37 errors

No correct solution

OTHER TIPS

For linux:

javac -cp .*:java-cup-0.11a.jar PascalLexer.java  

For windows:

javac -cp .*;java-cup-0.11a.jar PascalLexer.java  

Linux classpath is separated by a :, where windows separates by ;. Make sure you include any libs you need in the command, all separated by the appropriate delimiter. You will have to tell it where to find the libs, so if java-cup-0.11a.jar is not in the current working directory, you will need to specify the path to that file in your -cp argument.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top