Вы находитесь на странице: 1из 3

Nii Bonney T-Mensah 16 October 2010

Index# B020907073

BIT LEVEL 400

ICT 444- COMPILERS AND TRANSLATORS

ASSIGNMENT

1. Define Compiler and Interpreter and give 10 differences between them


The program written by the programmer in higher-level language is called source program, after this
the source program is converted to machine language for it to be executed. The source program can
either be compiled by the compiler or translated by the Interpreter.
Compilers are programs which translate computer programs from high-level languages such as Pascal,
C++, Java or JavaScript into the raw 1s and 0s which the computer can understand, but the human
programmers cannot , It is called compiler because it compiles every program instruction given in
higher-level languages into machine language.
Interpreters are another type of program translator used for translating higher-level language
instructions into machine language instructions. An interpreter is a program the translate written source
language into target programing language can be understood and executed by the CPU line by line. As
the first line is encountered by the interpreter, it is translated and executed. Then it moves to the next
line of source code and repeats the process. An interpreter has no memory.
Differences between Compiler and Interpreter
1. In the Interpreter translation and execution are carried out for each statement.
2. In the Compiler it translate the entire source program into machine code.
3. The interpreter compared to a compiler has a fast response to changes in source program. It
eliminates the need for a separate compilation after changes to each program.
4. In the compiler The program can only be executed once translation is complete and any changes
to the source code require a complete recompilation.
5. Interpreters are easy to write and do not require large memory in computer.
6. Interpreter is a time-consuming method because each time a statement in a program is executed,
it is first translated. Thus compiled machine language program runs much faster than an
interpreted program.
7. The interpreter has no "memory" for the translated lines, so if it comes across lines of the
program within a loop, it must translate them afresh every time that particular line runs.
8. Interpreters are useful for program development when execution speed is not important. As the
interpreter is in command of the execution process debugging features can be build in.
9. Compiler spends a lot of time analyzing and processing the program the resulting executable is
some form of machine- specific binary code the computer hardware interprets (executes) the
resulting code program execution is fast.
10. Interpreter relatively little time is spent analyzing and processing the program the resulting
code is some sort of intermediate code the resulting code is interpreted by another program

References
• http://www.computing.net/
• http://en.wikipedia.org/wiki/ compiler

Вам также может понравиться