Question

A) Please Give me a brief description of the role of a symbol table in a...

A) Please Give me a brief description of the role of a symbol table in a compiler.
B) At what phase of program implementation is data added to symbol table?
C) At what phase of implementation is information from the symbol table used?
D) How the symbol table is organized?

Thank you in advance!
0 0
Add a comment Improve this question Transcribed image text
Answer #1

A) Role of a symbol table in a compiler

Symbol table is one of the most important data structure used in a compiler during the process of conversion of program from the respective language to machine code.

Symbol Table is an data structure created and maintained by the compiler in order to keep track of semantics of variable i.e. it stores information about scope and binding information about names, information about instances of various entities such as variable and function names, classes, objects, etc. it is used in both the analysis and synthesis phases. and play a vital role in finding of compile time errors

The symbol table is used for the following :-

  • It is used to store the name of all entities in a structured format at one place for their use in the translation of the program from given language to machine code .
  • It is used to check that if a variable has been declared or not .
  • It is used to determine the scope of a variable (i.e. till which block it's scope extends).
  • It is used to implement type checking i.e. whether correct type is assigned to the variable (compile time error finding)

B) The information is collected by the analysis phases of compiler

C)The information stored is used by synthesis phases of compiler to generate code

D)A symbol table can either be linear {O(n) access time } or a hash table format {O(1) access time }.

Add a comment
Know the answer?
Add Answer to:
A) Please Give me a brief description of the role of a symbol table in a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT