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

Discussion

A common reason to prefer recursive descent in a production compiler is

  • A.the automatic generation of the abstract syntax tree
  • B.the freedom to depart from pure context free parsing where needed
  • C.the guarantee that the grammar will be unambiguous by construction
  • D.the smaller memory footprint of the generated tables

Answer: B

Correct answer: the freedom to depart from pure context free parsing where needed

A hand-written parser can consult the symbol table, look ahead as far as it likes, and handle a construct specially when the grammar cannot. Real languages contain such constructs, and that flexibility - together with the ability to produce good error messages - is why several major compilers use recursive descent.

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

Post your comment

Please log in or register to post a comment.