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

Discussion

A language requiring declaration before use simplifies compilation because

  • A.the symbol table can then be implemented as a simple flat array
  • B.no scoping rules are needed for such a language at all
  • C.the parser can then be written without any lookahead
  • D.the attributes of every name are known when the use is compiled

Answer: D

Correct answer: the attributes of every name are known when the use is compiled

With the declaration guaranteed to have been seen already, the type, the scope and the storage are all in the symbol table when the use is compiled, so code and checks can be generated on the spot. Without that guarantee the compiler must defer, and a second pass or a patching mechanism becomes necessary.

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

Post your comment

Please log in or register to post a comment.