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

Discussion

Consider the following statements about compiler phases.
1. The optimisation phase is optional in a working compiler.
2. The symbol table manager interacts with almost every phase.
3. Semantic analysis precedes syntax analysis in the usual order.

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

Answer: A

Correct answer: 1 and 2 only

The first two are correct. Optimisation is optional - a compiler that omits it produces correct if slower code, which is why compilers offer optimisation levels. And the symbol table manager interacts with almost every phase.

The third reverses the order. Syntax analysis comes first and builds the tree; semantic analysis then walks that tree checking types and scopes. There is no tree for semantic analysis to work on until the parser has produced one.

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

Post your comment

Please log in or register to post a comment.