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

Discussion

Consider the following statements about the symbol table.
1. It is created and used by several phases rather than by one.
2. It records attributes such as type, scope and storage location.
3. It is discarded as soon as syntax analysis is complete.

  • A.1 only
  • B.All of them
  • C.1 and 2 only
  • D.3 only

Answer: C

Correct answer: 1 and 2 only

The first two are correct. The symbol table is created during lexical and syntax analysis and consulted by every later phase, and it records type, scope, storage location and other attributes.

The third is false and would break the compiler. Semantic analysis needs the types, the intermediate code generator needs storage information, and the code generator needs offsets - all held there. The table is one of the few structures that persists across the whole compilation.

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

Post your comment

Please log in or register to post a comment.