0
你好,我不明白爲什麼在assgnStmt生產中存在衝突。我正在使用coco/R,並在「assgnStmt:ID is start & successor of deletable structure」中得到「LL1警告」。 謝謝。語法LL(1)衝突
COMPILER program
CHARACTERS
Letter= 'a'..'z'.
Digit= '0'..'9'.
TOKENS
NUM= Digit {Digit}.
ID= Letter {Letter}.
PRODUCTIONS
program
= stmts
.
stmts = assgnStmt { assgnStmt ';' } .
assgnStmt
= {ID "==" } expr
.
expr = term { ('+' | '-') term } .
term = factor { ('*' | '/' ) factor } .
factor
= '(' expr ')'
| ID
| NUM
.
END program.
我添加了,這是更一般化的,使語義分析能夠做正確的工作。 –
blob
是的,我應該提到這個選項。無論如何,我希望答案有所幫助。 – rici