The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+6 votes

Which data structure in a compiler is used for managing information about variables and their attributes?

  1. Abstract syntax tree
  2. Symbol table
  3. Semantic stack
  4. Parse table
asked in Compiler Design by Veteran (96.5k points)
edited by | 876 views

3 Answers

+19 votes
Best answer
Symbol table is answer . It can be implemented by using array , hash table , tree and eve some time with the help of lInked list !
answered by Veteran (10.4k points)
selected by
+14 votes
B. It uses array to implement.
answered by Veteran (19.3k points)
The symbol table is actually a array implementation.
It is Symbol Table only. Mostly implemented as Hash tables.
We use hash table instead of array in symbol table bcz in array we cant exceed the size of array .
can any one tell me if they ask symbol table is easily implemented by and options are 1. hash table 2. array what will be the answer??
@rajan obviously Hash table. as time complexity f searching inserting is O(1) using hash table.
0 votes

Symbol table is an important data structure created and maintained by compilers in order to store information about the occurrence of various entities such as variable names, function names, objects, classes, interfaces, etc. Symbol table is used by both the analysis and the synthesis parts of a compiler.

If a compiler is to handle a small amount of data, then the symbol table can be implemented as an unordered list, which is easy to code, but it is only suitable for small tables only. A symbol table can be implemented in one of the following ways:

  • Linear (sorted or unsorted) list
  • Binary Search Tree
  • Hash table

Among all, symbol tables are mostly implemented as hash tables, where the source code symbol itself is treated as a key for the hash function and the return value is the information about the symbol.

answered by Boss (6.6k points)

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

28,947 questions
36,793 answers
34,690 users