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

Discussion

Scope information is needed by the compiler in order to

  • A.decide which declaration a given use of a name refers to
  • B.determine the order in which the phases of the compiler run
  • C.choose between the available addressing modes of the target
  • D.decide how many passes the compiler will need to make

Answer: A

Correct answer: decide which declaration a given use of a name refers to

The same identifier may be declared several times in nested scopes, and a use must be bound to exactly one of them - ordinarily the innermost enclosing declaration.

Scope information in the symbol table is what makes that resolution possible, and the type of the reference follows from it. Everything downstream depends on getting it right: type checking, storage allocation and code generation all concern the particular object bound, not merely the name.

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

Post your comment

Please log in or register to post a comment.