Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to use EOF in SL.cup

224 views
Skip to first unread message

chao yan

unread,
Nov 22, 2005, 5:25:20 PM11/22/05
to
If I add "termnial EOF; " in SL.cup, I'll receive an error as follows:
............
Parsing specification from standard input...
JavaCUP Fatal Internal Error Detected
Duplicate terminal (EOF) created
java_cup.internal_error: Duplicate terminal (EOF) created
at java_cup.terminal.<init>(terminal.java:38)
at java_cup.terminal.<init>(terminal.java:58)
...........


If I add "endoffile ::= EOF;" in SL.cup without adding "termnial EOF; ",
I'll receive an error as follows:
.....
Parsing specification from standard input...
Error at 464(7): java_cup.runtime.Symbol "EOF" has not been declared
Closing files...
------- CUP v0.10j Parser Generation Summary -------
1 error and 0 warnings
32 terminals, 34 non-terminals, and 72 productions declared,
producing 0 unique parse states.
.......

I'm really confused by the error message.
If I declare EOF terminal, CUP says "Duplicate terminal", which means
"EOF" terminal is already avaiable.
if I don't declare EOF terminal, CUP says ""EOF" has not been declared",
which means "EOF" termnial is not available.

How can I use EOF in my SL.cup? I really need to do something at end of
the sl file.

Thanks

Chao Yan

Tom Gault

unread,
Nov 22, 2005, 10:53:41 PM11/22/05
to
There's a start non-terminal, and if you put code after it processes the SL
non-terminal, then it'll be executed after the whole program's been
processed. That's almost like EOF, right?

From Tom

"chao yan" <coli...@hotmail.com> wrote in message
news:dm05sm$88q$1...@rumours.uwaterloo.ca...

0 new messages