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.
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.
Please log in or register to report this question.