Monday, December 12, 2011

How are Programs Understood by the Computer?


Compiler: is a program whose task is to accept as input a source program written in a certain high-level language and to produce as output an object code or assembly code.
Interpreter: is a program that ultimately performs the same function as a compiler, but in a different manner. It works by scanning through the source program instruction by instruction. As each instruction is encountered, the interpreter translates it into machine code and executes it directly.
Assembler: is a program that automatically translates the source program written in assembly language and to produce as output an object code written in binary machine code.
Linker: is a program that takes one or more objects generated by compilers and assembles them into a single executable program.
Loader: (is a routine that) loads an object program into memory of the processor and prepares it for execution

Compiler
A program whose task is to accept as input a source program written in a certain high-level language and to produce as output an object code which can be run on the computer.





Assembler
A program that automatically translates the source program written in assembly language and to produce as output an object code written in binary machine code.
Interpreter
A program that ultimately performs the same function as a compiler, but in a different manner. It works by scanning through the source program instruction by instruction. As each instruction is encountered, the interpreter translates it into m/c code and executes it directly.
Comparison between Compiler and Interpreter
Compiler:
-Converts the source code program into m/c code before program execution
-Can be removed from memory after compilation is finished
-Compilation is faster, translation occurs with program execution
-Compilation results in an object code on direct execution
-More complicated error checking
Interpreter:
-Converts each source program line into m/c code as it executes, line by line.
-Must be continuously resident in memory while the program is being executed
-Interpretation is slower. There is no concurrent translation and so consumes time
-No object code results for that can be executed later
 -Easier error checking
linker
Is a program that takes one or more objects generated by compilers and assembles them into a single executable program.
Figure of the linking process, where object files and static libraries are assembled into a new library or executable.






No comments:

Post a Comment