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

Discussion

The number of states in an LR automaton for a typical programming language grammar is

  • A.exponential in the number of nonterminals in every case
  • B.in the hundreds, growing roughly with the size of the grammar
  • C.exactly equal to the total number of productions in the grammar
  • D.always fewer than the number of terminals in the language

Answer: B

Real grammars produce a few hundred states for a language of moderate size. The exponential worst case exists in theory but is not approached by practical grammars. Grammar size rather than pathological structure is what drives the count.

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

Post your comment

Please log in or register to post a comment.