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

Discussion

Left factoring is required when two alternatives

  • A.are both capable of deriving the empty string
  • B.appear in different productions of the same grammar
  • C.begin with the same sequence of grammar symbols
  • D.generate one and the same collection of terminal strings

Answer: C

A shared prefix makes the FIRST sets overlap, so one token of lookahead cannot choose. Factoring the prefix out lets the parser commit to it and postpone the choice. Several rounds of factoring may be needed when alternatives share nested prefixes.

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

Post your comment

Please log in or register to post a comment.