search
Log In
8 votes
3.3k views

Which statement is true?

  1. LALR parser is more powerful and costly as compare to other parsers
  2. All CFG's are LP and not all grammars are uniquely defined
  3. Every SLR grammar is unambiguous but not every unambiguous grammar is SLR
  4. LR(K) is the most general back tracking shift reduce parsing method
in Compiler Design
edited by
3.3k views

2 Answers

12 votes
 
Best answer

Answer : C

A . Most powerful and costly order is

     LR(0) < SLR(1) < LALR(1) < CLR(1)

B . The grammar generated by LP are CFG but not implying All CFG are LP.

C . Every SLR grammar is unambiguous but not every unambiguous grammar is SLR 

D . LR(k) is the most general non back tracking shift reduce parsing method 


selected by
0
what kind of mistake in C option ?
0
I have seen the official paper of isro in which option c is

Every SLR grammar is unambiguous but not every unambiguous grammar is SLR
0
Ok that's fines then how you come to conclusion that option B is correct.
0
I did not understand the meaning of LP that why i left the option without exploring .because all others are wrong .
1
Ya LP here is  Linear precedence rule.

The grammar generated by LP are CFG but not implying All CFG are LP.
0
so it makes all the option B also wrong .then there must be a correction in option c and the answer would be C
0
yes
0
what is LP?
0
0 votes
Option C will be right option.

According to more error capability along with cost order of different types of parser is given.

CLR(1)>LALR(1)>SLR(1)>LR(0)

But according to number of state .

n4>=n3=n2=n1

There is no property of non back tracking shift reduce in any parser.

So only option C will be right option bcz only operator precedence grammar will act with amgiguos grammar and all grammar act with unambiguos grammar along not all unambiguos grammar will be SLR(1).

So option C will be right.
0
what do you mean by  n4,n3,n2,n1  clearly specify naaa
Answer:

Related questions

7 votes
3 answers
1
2.3k views
Which one of the following is a top-down parser? Recursive descent parser Shift left associative parser SLR(k) parser LR(k) parser
asked Jun 17, 2016 in Compiler Design jothee 2.3k views
12 votes
3 answers
2
3.4k views
Which grammar rules violate the requirement of the operator grammar? A, B, C are variables and a, b, c are terminals $A \rightarrow BC$ $A \rightarrow CcBb$ $A \rightarrow BaC$ $A \rightarrow \epsilon$ (a) 1 only (b) 1 and 2 (c) 1 and 3 (d) 1 and 4
asked Jun 17, 2016 in Compiler Design jothee 3.4k views
16 votes
1 answer
3
3.8k views
Consider the following code fragment void foo(int x, int y) { x+=y; y+=x; } main() { int x=5.5; foo(x,x); } What is the final value of x in both call by value and call by reference, respectively? 5 and 16 5 and 12 5 and 20 12 and 20
asked Jun 21, 2016 in Compiler Design jothee 3.8k views
5 votes
2 answers
4
1.3k views
Yacc stands for yet accept compiler constructs yet accept compiler compiler yet another compiler constructs yet another compiler compiler
asked Jun 17, 2016 in Compiler Design jothee 1.3k views
...