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

Discussion

Translating an infix expression into postfix notation is

  • A.impossible without inherited attributes carrying precedence
  • B.achieved only by a separate pass over the finished tree
  • C.performed by the lexical analyser rather than the parser
  • D.a classic S-attributed translation using string concatenation

Answer: D

Each rule concatenates the postfix strings of its operands and appends the operator. The grammar's own structure supplies the precedence, so no extra attributes are needed. The example is the standard first illustration of an S-attributed definition.

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

Post your comment

Please log in or register to post a comment.