We are going to start compiler design compulsory question so we need to know some basic topics like what is compiler ,what is compiler design , Applications of compiler design lets start with first topic what is compiler design.
- Compiler design:-
A compiler is a computer software that transform computer code written in one programming language (source code) into another programming language
compiler are type of translator that support digital device.
Applications of compiler design :
The name compiler is primarily used for programs that translate source code from a high level programming language to low level programming language.
Compiler is used to show errors to the programmer.
- What is Symbol table? Discuss the typical entries in it?
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.
Applications of symbol table:-
In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter.
Entries in compiler symbol table:-
A symbol table is simply a table which can be either linear or a hash table. It maintains an entry for each name in the following format.
<symbol name, type, attribute>
For example, if a symbol table has to store information about the following variable declaration.
static int interest;
then it should store the entry such as:
<interest, int, static>
A symbol table can be implemented in three ways:
Binary Search Tree
- What is the issues in design of a code generator?
In computing, code generation is the process by which a compiler’s code generator converts some intermediate representation of source code into machine code that can be readily executed by a machine.
issues in code generator:-
issues in the design of code generator.
Memory management – Mapping names in the source program to addresses of data objects in run time memory is done by front end & code generator.
- Discuss various target for code optimization?
Optimization is a program transformation technique, which tries to improve the code by making it consume less resources (i.e. CPU, Memory) and deliver high speed.
In optimization, high-level general programming constructs are replaced by very efficient low-level programming codes. A code optimizing process must follow the three rules given below:
The output code must not, in any way, change the meaning of the program.
Optimization should increase the speed of the program and if possible, the program should demand less number of resources.
Optimization should itself be fast and should not delay the overall compiling process.