Machine-translated by Google. Questions are authored in English.
Top

Discussion

A single token of lookahead is insufficient for a grammar in which

  • A.the grammar happens to contain any epsilon productions at all
  • B.any nonterminal has more than two alternatives
  • C.the grammar has more terminals than nonterminals
  • D.two alternatives share a prefix longer than one symbol

Answer: D

Left factoring fixes this when the shared prefix is a fixed string of symbols. When the shared prefix can be arbitrarily long, no amount of factoring makes the grammar LL(1). Such constructs are exactly where the top down approach reaches its limit.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.