views:

78

answers:

1

What is the function of symbol table in front-end and back-end of compiler?

+1  A: 

Symbol table stores the information about the symbols you use in your program.

For example, consider a simple C declaration statement.

int a;

Information regarding 'a', are

  1. Name of the variable used is 'a'.
  2. It is an integer variable.
  3. It is declared in global scope.
  4. It is uninitialized by user (global variables will be initialized to zero but to do that you need the information).

Likewise for every symbol you use in your program, the information will be updated in the symbol table for the translation to low level language.

Use of symbol tables lie mostly in front-end, in the back-end it may be used to handle the symbol names wherever necessary (like printing module). But I am not sure though!

Ganesh Gopalasubramanian