In: Computer Science
7. What role does the symbol table play in a compiler? When is it created?
8. What are two unique advantages of implementing a language with a runtime interpreter i.e. scheme, python) versus a standalone executable file (i.e. C, C++)?
Answer 7
Symbol tables are mainly data structure used to store information about source program. Basically it maintains the occurrence of various program fields like variables, functions, objects and classes etc. It is also used to store binding and scoping of names.
Symbol table can also be used for type checking It is created during lexical and syntax analysis phases of compilation.
During lexical analysis compiler creates new entries in table and during syntax analysis compiler adds information for that entry like scoping etc.
Answer 8
Main advantage is Less error prone to crashing as mostly they will not access source computer directly instead will be run by some kind of virtual machine. So first program will be run in virtual machine and if anything wrong virtual machine will crash but nothing will happen to main system.
Second, This kind of language needs less memory to run as only line which needs to be execute must be in memory.