0

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.

Community
  • 1
  • 1
shogitai
  • 1,823
  • 1
  • 23
  • 50
  • 1
    Notice the messages **1 error and 0 warnings** and **No code produced** from CUP. There's something wrong in your CUP grammar. You should be seeing some other messages from CUP explaining what the problem is. – Kevin Anderson May 20 '17 at 23:32
  • I reviewed many parts of my CUP grammar and now it works, but not sure where was the problem. I suppose some non terminal symbol to be not declared. – shogitai May 21 '17 at 20:12

0 Answers0