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

Discussion

A recursive descent parser is naturally suited to building

  • A.the graph of basic blocks used later for optimisation
  • B.one table of names covering every scope in the program at once
  • C.an abstract syntax tree returned by each parsing procedure
  • D.a parse table indexed by nonterminal and by lookahead token

Answer: C

Correct answer: an abstract syntax tree returned by each parsing procedure

Each procedure recognises one construct, so it is the natural place to build the node for that construct from the nodes its callees return. The tree is assembled bottom up as the recursion unwinds, and no separate tree-building pass is needed.

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

Post your comment

Please log in or register to post a comment.