Save
CPET 140 : Computer Programming
Chapter 1 : Introduction to Computer Programming
Translators
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
five
Visit profile
Cards (29)
A
translator
is a computer program that can convert a program or source code to machine level language for its debugging and execution.
There are three types of translators :
Assembler
,
Interpreter
and
Compiler.
Assembler
converts assembly language to machine language.
Interpreter
converts high-level language code line by line into machine language and executes it immediately.
Compiler
converts the entire
high level
source code into
machine code
before execution.
Assembler's input language is
assembly
language.
Interpreter's input language is
high-level
language.
Compiler's input language is
high-level
language.
Assembler's output language is
machine language
( low-level ).
Interpreter's output language is
machine code
( line by line execution ).
Compiler's output language is
machine code
( object / executable file ).
Assembler's
execution timing is after full assembly.
Interpreter's
execution timing is line-by-line, during interpretation.
Compiler's
execution timing is after complete
compilation.
Assembler's
speed of execution is faster than interpreter ( machine-level code ).
Interpreter's
speed of execution is slower, as it interprets and executes code line by-line.
Compiler's
speed of execution is faster than interpreter due to pre-compiled executable.
Assembler's
translation process is one-to-one mapping between assembly and machine instructions.
Interpreter's
translation process translates and executes each line at runtime.
Compiler's
translation process translates the whole program at once before execution.
Assembler's
platform dependency is platform / machine dependent.
Interpreter's
platform dependency is platform independent ( to an extent, depending on the interpreter used ).
Compiler's
platform dependency is platform independent ( but compiled code is platform-specific ).
Examples of assembler are
MASM
,
NASM
,
TASM
.
Examples of interpreter are
BASIC
,
Python
( when interpreted ),
JavaScript.
Examples of compiler are
C
,
C++
,
FORTRAN
.
Interpreter
converts the
high-level
language code,
line
by line and is normally carried out just before the execution of a program line.
Each line is converted to machine language and is immediately executed and passed onto next line code.
In case of the
compiled code
, the
source code
is completely analyzed and translated at the time of
compiling
.