«« ( Date ) »» // «« ( Thread ) »» // ri4pp - 2006

Problem: CUP

by Vladimir Basanovic
sreda, 18. januar 2006 - 16:44.

Imam problem:
Ovi iskomentarisani redovi nece da se kompajliaju kada se skinu komentari.
term ::= term mulop faktor;
term ::= IDENT;
term ::= INTEGER;
term ::= IDENT LIPAREN izraz RIPAREN;
term ::= LEN LPAREN IDENT RPAREN;
faktor ::= LEN LPAREN IDENT RPAREN;
//term ::= poziv_funkcije;
//faktor ::= poziv_funkcije;
faktor ::= IDENT LIPAREN izraz RIPAREN;
faktor ::= IDENT;
faktor ::= INTEGER;

//poziv_funkcije ::= IDENT LPAREN RPAREN;
//poziv_funkcije ::= IDENT LPAREN lista_var RPAREN;

greska je :

*** Shift/Reduce conflict found in state #97
between term ::= IDENT (*)
and poziv_funkcije ::= IDENT (*) LPAREN RPAREN
and poziv_funkcije ::= IDENT (*) LPAREN lista_var RPAREN
under symbol LPAREN
Resolved in favor of shifting.

*** Shift/Reduce conflict found in state #129
between faktor ::= IDENT (*)
and poziv_funkcije ::= IDENT (*) LPAREN RPAREN
and poziv_funkcije ::= IDENT (*) LPAREN lista_var RPAREN
under symbol LPAREN
Resolved in favor of shifting.

Checking for non-reduced productions...
*** More conflicts encountered than expected -- parser generation aborted
Closing files...
------- CUP v0.10k Parser Generation Summary -------
1 error and 9 warnings
62 terminals, 29 non-terminals, and 102 productions declared,
producing 260 unique parse states.
7 terminals declared but not used.
0 non-terminals declared but not used.
0 productions never reduced.
2 conflicts detected (0 expected).
No code produced.
---------------------------------------------------- (v0.10k)
vladab@basanovic:~/eclipse/workspace/domaci>

Osim toga imam problem i sa zagradama. POkusao sam ovako :
izraz ::= LPAREN izraz RPAREN;
izraz ::= izraz LPAREN izraz RPAREN;
ali nece da radi kako treba!

Hvaka unapred!