1,405 views
S→(X

S→E]

S→E)

X→E)

X→E]

E→ϵ

Is this grammar CLR(1)? The answer says it is but I find a shift reduce conflict for E-> epsilon with lookup symbols ),]

LR 1 for given grammer is

its shows there are no RR conflicts and SR conflicts.

Canonical LR(1) items

S' --> .S,$S --> .E],$

--> .E),\$

E --> .,] / )

Shift reduce conflict exist when there is terminal(Action part), not (GOTO part) and there is reduction production

This Grammar is CLR(1), there is no Shift -Reduce Conflict exist.

what is action and goto part?

Action is transition on a terminal and GOTO is transition on a non terminal right?

So SR conflicts happen when transitions happen on terminal when there is a reduce but not on non terminal right?
yes!
In parsing table, within "Action", for a Terminal, if both Shift and reduce entires exists for same production, then it's SR conflict.

If two reduce moves in under same Terminal and production then it's a RR conflict

1 vote
1
4,792 views