Aman Deep Gautam Aman Deep Gautam - 3 months ago 11x
Java Question

jFlex error: class throws

I have written a very simple file with specification shown below to to tokenize words:

%class Lexer

WORD = [^\r\n\t ]

{WORD} {System.out.println("Word is:"+yytext());}

. {System.out.println("Bad character: "+ yytext());}

The following are the commands I run:

jflex hindi.jlex

I get the following error: cannot find symbol
symbol : class Yytoken
location: class Lexer
public Yytoken yylex() throws {
1 error

Any help appreciated.

On a additional note I checked the
file and there was no
function in it. Is that the reason for this error.


If you want to check the lexer standalone(without a parser) then add the following to the user code section: