Search code examples
parsingjflex

simple JFflex parser translates to java OK. Error when compiling java code


I have this simple Bison JFLEX parser : http://pastebin.com/SNB20y7G

I ran jflex parser.flex ( this is how my file is called) obtained a class called TuringLexer.java When I try to compile it with javac TuringLexer.java I get this:

$ javac TuringLexer.java
TuringLexer.java:482: cannot find symbol
symbol  : class Yytoken
location: class TuringLexer
  public Yytoken yylex() throws java.io.IOException {
         ^
1 error

Any clue what the issue might be? Thank you!


Solution

  • The issue was that I had forgotten to add:

    %public
    %class TuringLexer
    %type Void
    

    instead of just

       %class TuringLexer
    

    now the .java file works aswell