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

Discussion

The main reason a compiler course teaches top down parsing before bottom up is

  • A.top down parsing is the only method used in real compilers
  • B.the correspondence between the grammar and the code is direct
  • C.top down parsers handle a larger class of grammars
  • D.bottom up parsing cannot be implemented without a tool

Answer: B

Correct answer: the correspondence between the grammar and the code is direct

A recursive descent parser can be read alongside its grammar, so the mechanics of parsing are visible rather than hidden in a table. That transparency makes it the natural first method, and it prepares the ground for tables by making clear what a table is doing.

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

Post your comment

Please log in or register to post a comment.