retagged by
7,998 views
1 votes
1 votes
confuse among clr and lalr??

what is necessary and sufficient condition for clr??

what is necessary and sufficient condition for lalr???

when it's clr & when not??

when it's lalr & when not??
retagged by

1 Answer

Best answer
3 votes
3 votes

i havnt understood ur question properly but let me try

both CLR(1) and LALR(1) have one lookahead....if u will construct the parsing table for CLR(1)...it will contain the maximum no of rows...because here we divide each state based on its lookahead....there will be more spaces in the table and hence more error detecting capacity...we move from LR(0) to SLR(1) to CLR(1) so that error handling can be increased...

if u get two states in CLR(1) parsing table like
1.S->a.,$
  S->a.a,$

2.S->a.,b
   S->a.a,$/b

u have to place both in different states since lookaheads are different...
but if u merge them in LALR(1)...u will get one state as

  S->a.,$/b
  S->a.a,$/b
so if u could merge two states with different lookaheads we get LALR(1)

one more thing...if a grammar  is not CLR(1)..its definitly not  LALR(1) also...
but if it is CLR(1)...it doent mean it is always LALR(1) because it is possible that with different lookaheads u will not get ant SR or RR conflict in CLR(1) but when u will merge them there could be an error in LALR(1)..

for more clearance on this u can watch this...how we can merge different states

https://gateoverflow.in/72198/made-easy-test-series

selected by

Related questions

19.2k
views
1 answers
0 votes
Aspi R Osa asked Jan 22, 2016
19,212 views
Could someone please help me check the conflicts in LALR parser. I never understand the difference between these CLR and LALR. and because of this i even forget the SLR parser. please if someone can explain it easily?
3.4k
views
1 answers
2 votes
sripo asked Nov 10, 2018
3,401 views
Can you give an example which is not LL(1) but is CLR(1)
1.3k
views
1 answers
1 votes
Rajesh R asked Dec 3, 2017
1,339 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.
16.0k
views
3 answers
8 votes
Parshu gate asked Nov 13, 2017
16,003 views
Suppose we are given a grammar and asked to find the type of that grammar , what is the algorithm which needs to be followed for each of them? LL(1), OR LR(0) , OR CLR(1) OR LALR(1)