in Compiler Design edited by
2,472 views
16 votes
16 votes

Which of the following correctly describes $\text{LR}(k)$ parsing?

  1. The input string is alternately scanned left to right and right to left with $k$ reversals.
  2. Input string is scanned once left to right with rightmost derivation and $k$ symbol look-ahead.
  3. $\text{LR}(k)$ grammers are expressively as powerful as context-free grammers.
  4. Parser makes $k$ left-to-right passes over input string.
  5. Input string is scanned from left to right once with $k$ symbol to the right as look-ahead to give left-most derivation.
in Compiler Design edited by
2.5k views

1 comment

For Option C

Any $LR(k)$ grammar is equivalent to $LR(1)$ grammar, which is equivalent to DCFG

Hence, $LR(k)$ is expressively as powerful as DCFG, and not CFG as a whole.


Or, simply you can disprove Option C by taking an ambiguous CFG. Any ambiguous grammar can't be parsed by a parser (except Operator Precedence Parser)

3
3

2 Answers

18 votes
18 votes
Best answer
  1. Does not make any sense. false.
  2. This is definition of LR($k$) Parser. True
  3. False. LR($k$) is subset of CFL.
  4. False.
  5. LR($k$) , bottom up parser . We have Right most derivation. This is False.

Answer :- B

edited by

4 Comments

LR(k) grammar is unambiguous grammar where context free grammar can be ambiguous or unambiguous .Therefore LR(k) is a subset of Context free grammar.

Is it right?
0
0
I think option b also not fully correct  as bottom up parser use reverse of right most derivation.
0
0
What is the logic for right mos derivation?
0
0
1 vote
1 vote

1 comment

@srestha

Could you explain how it is B. LR(k) is left to right with rightmost derivation in reverse

0
0
Answer:

Related questions