edited by
5,554 views
10 votes
10 votes

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. $\text{LR(K)}$ is the most general back tracking shift reduce parsing method
edited by

2 Answers

Best answer
14 votes
14 votes

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 votes
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.
Answer:

Related questions

9 votes
9 votes
2 answers
1
go_editor asked Jun 17, 2016
2,138 views
Yacc stands foryet accept compiler constructsyet accept compiler compileryet another compiler constructsyet another compiler compiler
10 votes
10 votes
3 answers
2
go_editor asked Jun 17, 2016
3,555 views
Which one of the following is a top-down parser?Recursive descent parserShift left associative parser$\text{SLR}(k)$ parser$\text{LR}(k)$ parser
13 votes
13 votes
3 answers
3
go_editor asked Jun 17, 2016
6,240 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 \rightarr...
19 votes
19 votes
2 answers
4
go_editor asked Jun 21, 2016
7,160 views
Consider the following code fragmentvoid foo(int x, int y) { x+=y; y+=x; } main() { int x=5.5; foo(x,x); }What is the final value of $\textsf{x}$ in both call by value an...