What is complier ?
phases of compiler
1. Lexical Analysis
2. Syntax Analysis
3. Semantic Analysis
4. Intermediate Code Generation
5. Code Optimization
1. The next phase does code optimization of the intermediate code.
2. Optimization can be assumed as something that removes unnecessary code lines, and arranges the sequence of statements in order to speed up the program execution without wasting resources (CPU, memory).
6. Code Generation
1. Code generation is the last and final phase of a compiler.
2. It gets inputs from code optimization phases and produces the page code or object code as a result.
3. The objective of this phase is to allocate storage and generate relocatable machine code. It also allocates memory locations for the variable.
4. The instructions in the intermediate code are converted into machine instructions. This phase coverts the optimize or intermediate code into the target language.
5. The target language is the machine code. Therefore, all the memory locations and registers are also selected and allotted during this phase.
6. The code generated by this phase is executed to take inputs and generate expected.
Difference between interpreter and compiler:
Interpreter
1. In source program gets interpreted every time, it is to be executed and every time the source program is analyzed.
2. Interpretation is less efficient than compiler.
3. The interpreters do not produce object code.
4. The interpreters can be made portal because they do not produce object code.
5. Interpreters are simpler and give us improved debugging environment.
Compiler
1. In the process of compilation the program is analyzed only once and then the code generated.
2. complier is efficient than interpreter.
3. The compiler produce object code.
4. The compilers has to be present on the host machine when particular program needs to be compiled.
5. The compiler is a complex program and it requires large amount of memory.
2 Comments
good job...
ReplyDeleteVery Helpful...
ReplyDelete