622 views
3 votes
3 votes

Grammar
 S $\rightarrow$ S1

S1 $\rightarrow$ S1 = S1 | a

Where = is the assignment operator in C

  1. LALR(1) Machine cannot be constructed with this grammer
  2. inadequate states can be resolved using the fact that the = is left associative
  3. inadequate states can be resolved using the fact that the = is right associative
  4. Both 2 and 3

2 Answers

0 votes
0 votes
Option 4

You will have to remove ambiguity first. Then it will be possible by taking a convention for = , either left or right associative. Check out  here : http://www.univ-orleans.fr/lifo/Members/Mirian.Halfeld/Cours/TLComp/res2-CG.pdf
0 votes
0 votes
GIVEN GRAMMAR IS OPERATOR PRECEDENCE GRAMMAR,SO WE CAN CONSTRUCT THE PARSING  TABLE,EVEN THOUGH IT IS AMBIGUOUS

Related questions

1 votes
1 votes
0 answers
2
radha gogia asked Apr 29, 2018
641 views
If there is an inadequate state , then how can the state be resolved :1. By using the fact that = is left associative .2. By using the fact that = is right associative ....
1 votes
1 votes
1 answer
3
Rajesh R asked Dec 3, 2017
1,224 views
A - AA+A - aI think it's both clr and lalr . Can someone draw the diagram and answer it please because I want to verify the lookaheads of some states.
2 votes
2 votes
1 answer
4
sripo asked Nov 10, 2018
3,181 views
Can you give an example which is not LL(1) but is CLR(1)