java_cup.runtime.Symbol "EOF" has not been declared

1.6k Views Asked by At

I have alreay read this discussion, but it didn't help me.

start with file;
file ::= primario SEP secondario SEP terziario EOF {:fm.scriviDebug();:};

Where fm.scriviDebug() is a my custom class that prints on stdout what CUP parsed.

I have no idea where is the problem.

Some infos:


I use JFLex to scan a file and passing symbols to CUP in the following way:

...
{bo} {System.out.println("[BO] ["+yytext() +"]");return symbol(sym.BO);}
{bc} {System.out.println("[BC] ["+yytext() +"]");return symbol(sym.BC);}
{sc} {System.out.println("[SC] ["+yytext() +"]");return symbol(sym.SC);}
{eq} {System.out.println("[EQ] ["+yytext() +"]");return symbol(sym.EQ);}
...

I get more than one warning of the following type:

Warning in file "Scanner.jflex" (line 115):
Expression matches the empty string, which may lead to non-termination.
   .*  {

This is what I get while "compiling" CUP:

Opening files...
Parsing specification from standard input...
Error at 63(73): java_cup.runtime.Symbol "EOF" has not been declared
Closing files...
------- CUP v0.10k Parser Generation Summary -------
1 error and 0 warnings
20 terminals, 14 non-terminals, and 18 productions declared,
producing 0 unique parse states.
0 terminals declared but not used.
0 non-terminals declared but not used.
0 productions never reduced.
0 conflicts detected (0 expected).
    No code produced.
---------------------------------------------------- (v0.10k)

Another error after compiling CUP fails:

 cannot find symbol
           { return new java_cup.runtime.Symbol(sym.EOF); }

Please, tell me if more info are required.

0

There are 0 best solutions below