GATE | GATE CS 2020 | Question 19
Consider the following statements.
- I. Symbol table is accessed only during lexical analysis and syntax analysis.
- II. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment.
- III. Errors violating the condition ‘any variable must be declared before its use’ are detected during syntax analysis.
Which of the above statements is/are TRUE ?
(A) I only
(B) I and III only
(C) Ⅱ only
(D) None of Ⅰ, Ⅱ and Ⅲ
Explanation: I. False. Symbol Table is used by all 6 phases of compiler: lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and target code generation phase.
II. False. Heap allocation is used to dynamically allocate memory to the variables. Heap allocation can be used for recursion, but recursion is also supported in Stack allocation.
III. False. Syntax analysis checks only syntax, but variable declare before its use must be done by Semantic analyses.
Option (D) is correct.