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

Discussion

Semantic actions in a recursive descent parser are placed

  • A.in a separate table indexed by production number
  • B.in the scanner alongside the token patterns
  • C.in a post processing pass over the token stream
  • D.directly in the code of the parsing procedures

Answer: D

Correct answer: directly in the code of the parsing procedures

Actions sit in the procedure at the point where the corresponding part of the construct has been recognised, so there is no separate mechanism at all - the parser and the translator are the same code. This freedom is one of the practical attractions of writing the parser by hand.

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

Post your comment

Please log in or register to post a comment.