search
Log In
19 votes
4.3k views

Assume that the SLR parser for a grammar G has $n_1$ states and the LALR parser for G has $n_2$ states. The relationship between $n_1$ and $n_2$ is

  1. $n_1$ is necessarily less than $n_2$
  2. $n_1$ is necessarily equal to $n_2$
  3. $n_1$ is necessarily greater than $n_2$
  4. None of the above
in Compiler Design 4.3k views
0
please explain me why n1 is necessarily equal to n2 and why not n1 is necessarily less than n2.

3 Answers

24 votes
 
Best answer
no of states in SLR and LALR are equal

and no of states in SLR and LALR are less than or equal to LR(1)

Correct Answer: $B$

edited by
0

Answer should be D. Right?

Because no of states in SLR and LALR are less than or equal to LR(1)

0
@Rishabh HEre comparision is asked for SLR(1) and LALR(1) in questions and no. in states in both these are equal.
14 votes
no of states

CLR(1)>=LR(0)=SLR(1)=LALR(1)
5 votes
ans b)
1
I think it should be less than equal to?
0
So pls explain whether it is less than equals to or only equal?
Answer:

Related questions

45 votes
10 answers
1
9.4k views
Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar? Removing left recursion alone Factoring the grammar alone Removing left recursion and factoring the grammar None of the above
asked Sep 16, 2014 in Compiler Design Kathleen 9.4k views
29 votes
3 answers
2
7.5k views
Consider the grammar shown below. $S \rightarrow C \ C$ $C \rightarrow c \ C \mid d$ This grammar is LL(1) SLR(1) but not LL(1) LALR(1) but not SLR(1) LR(I) but not LALR(1)
asked Sep 17, 2014 in Compiler Design Kathleen 7.5k views
37 votes
4 answers
3
6.1k views
Which of the following is NOT an advantage of using shared, dynamically linked libraries as opposed to using statistically linked libraries? Smaller sizes of executable files Lesser overall page fault rate in the system Faster program startup Existing programs need not be re-linked to take advantage of newer versions of libraries
asked Sep 17, 2014 in Compiler Design Kathleen 6.1k views
16 votes
8 answers
4
9.8k views
Which of the following is the most powerful parsing method? LL (1) Canonical LR SLR LALR
asked Sep 23, 2014 in Compiler Design Kathleen 9.8k views
...