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

Discussion

Inherited attributes are awkward in a bottom up parser because

  • A.the reductions occur in an unpredictable order during the parse
  • B.the parser has no access to the symbol table during parsing
  • C.the parent is not created until after its children are complete
  • D.the value stack cannot hold more than one value per symbol

Answer: C

Correct answer: the parent is not created until after its children are complete

An inherited attribute passes information from a parent or a left sibling down into a subtree, but a bottom up parser reduces the children first and creates the parent only afterwards. There is nothing to inherit from at the time it would be needed, so such attributes require marker nonterminals or values reached at known depths in the stack.

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

Post your comment

Please log in or register to post a comment.