in Compiler Design retagged by
1,405 views
0 votes
0 votes
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 ),]
in Compiler Design retagged by
by
1.4k views

2 Answers

1 vote
1 vote
Best answer

LR 1 for given grammer is 

its shows there are no RR conflicts and SR conflicts.

 

selected by
0 votes
0 votes
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.
edited by

3 Comments

what is action and goto part?

Please correct my logic

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?
0
0
yes!
0
0
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
0
0