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

Discussion

Reaching into the Yacc value stack at a negative offset to read an earlier value is

  • A.equivalent to declaring the attribute synthesised instead
  • B.a fragile technique that breaks if the grammar is changed
  • C.the recommended way to implement all inherited attributes
  • D.impossible

Answer: B

Correct answer: a fragile technique that breaks if the grammar is changed

Reading below the current production’s entries on the value stack works only if the surrounding productions always place the same thing there, which is an assumption the grammar may violate the moment it is edited. Marker nonterminals achieve the same effect explicitly and survive change.

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

Post your comment

Please log in or register to post a comment.