3,675 views
0 votes
0 votes

A symbol is a compile time data structure. In which of the following phase/s a symbol is modified ?

  • Only semantic analysis
  • None of these
  • Only lexical analysis
  • Lexical analysis and syntax analysis

3 Answers

1 votes
1 votes

Symbol Table is a data structure which holds all phases of compiler.There are several phases of compiler. In each phases compiler do modify the code to get High Level Language to a Assembly level Language.

Lexical Analysis Phase- It creates Stream of Tokens

Syntax Analysis Phase- It creates Parse Tree.

Type Checking Phase- It generates type expression.

Intermediate Code Generation-Generates 3 Address Code

Code optimization-Optimize the result.

So, Answer None of these

0 votes
0 votes
  1. Lexical Analysis: Creates new table entries in the table, example like entries about token.
  2. Syntax Analysis: Adds information regarding attribute type, scope, dimension, line of reference, use, etc in the table.
  3. Semantic Analysis: Uses available information in the table to check for semantics i.e. to verify that expressions and assignments are semantically correct(type checking) and update it accordingly.
  4. Intermediate Code generation: Refers symbol table for knowing how much and what type of run-time is allocated and table helps in adding temporary variable information.
  5. Code Optimization: Uses information present in symbol table for machine dependent optimization.
  6. Target Code generation: Generates code by using address information of identifier present in the table.

    Source: https://www.geeksforgeeks.org/symbol-table-compiler/

Related questions

0 votes
0 votes
1 answer
1
dd asked Dec 13, 2016
2,547 views
Which of the following symbol table implementation is based on the property of locality of reference?Search TreeHash TreeSelf-organizing ListArray
3 votes
3 votes
1 answer
2
Hira Thakur asked Aug 14, 2017
2,110 views
which DS takes less time to create Symbol table???a) Hash TableB) Linked Listis there is any other method to create Symbol table??what are the various option available t...
3 votes
3 votes
1 answer
3
Xylene asked Aug 8, 2017
1,535 views
Which of the following phases update the symbol table ?Lexical analysis, syntax analysis and semantic analysis .Please also tell what kind of updates a phase performs if ...
2 votes
2 votes
1 answer
4
Akriti sood asked Dec 8, 2016
12,053 views
Which of the following symbol table implementation is based on the property of locality of reference? Self-organizing list Hash tree Search tree Array