• edited by
7,791 views
11 11 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

2 Answers

Best answer
15 15 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 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:
Position:
Show:

Related questions

11 11 votes
2 answers 2 answers
3.4k
3.4k views
go_editor asked Jun 17, 2016
3,373 views
Yacc stands foryet accept compiler constructsyet accept compiler compileryet another compiler constructsyet another compiler compiler
10 10 votes
3 answers 3 answers
4.4k
4.4k views
go_editor asked Jun 17, 2016
4,402 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
14 14 votes
3 answers 3 answers
8.6k
8.6k views
go_editor asked Jun 17, 2016
8,635 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...
20 20 votes
2 answers 2 answers
9.2k
9.2k views
go_editor asked Jun 21, 2016
9,177 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...