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

Discussion

A useless nonterminal in a grammar is one that

  • A.derives no terminal string or is unreachable from the start symbol
  • B.appears on the right hand side of exactly one production only
  • C.has more alternatives than any other nonterminal present
  • D.derives only the empty string and nothing else besides

Answer: A

Correct answer: derives no terminal string or is unreachable from the start symbol

Either fault makes the nonterminal contribute nothing to the language: one that derives no terminal string can never complete a derivation, and one unreachable from the start symbol can never begin one. Both are removed before parsing, since they only complicate the tables and can mask genuine errors in the grammar.

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

Post your comment

Please log in or register to post a comment.