0

我已经阅读了这个讨论,但它对我没有帮助。

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

fm.scriviDebug()我的自定义类在哪里打印 CUP 解析的标准输出。

我不知道问题出在哪里。

一些信息:


我使用 JFlex 扫描文件并通过以下方式将符号传递给 CUP:

...
{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);}
...

我收到不止一个以下类型的警告:

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

这是我在“编译”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)

编译CUP失败后的另一个错误:

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

请告诉我是否需要更多信息。

4

0 回答 0