Computer Science - Programming Languages / Translators
This presentation explains the different types of translators and languages of programming such as assembler, compiler, interpreter, bytecode
2. Programmed code that has not yet been
compiled into an executable file
General name for any program that
translates code from one language to
another
(Definitions)
3. A program that translates a high–level
language into machine code by
translating all of the code
Compiled code that can be run as an
executable on any computer
(Definitions)
4. A program that translates a high–level language by
reading each statement in source code and
immediately performing the action
A program that translates a program written in
assembly language into machine code
(Definitions)
5. • The assembly code is known as source code and this is
translated into object code (compiled code) by an assembler.
• Before assembly code can be executed it must be translated
into the equivalent machine code. This is done by an
assembler.
• The assembler program takes each assembly code instruction
and converts it into the corresponding 0s and 1s.
• The input is called source code and the output is called object
code.
Assembler
6. • A compiler is a program that translates high-level
language (e.g. C++, Visual Basic etc.) into machine code.
• Source code is written by the programmer and input to
the compiler. It scans through several times , each time
performing different checks and building up tables of
information to produce the final object code.
• Different hardware platforms (Intel, Apple, etc.) require
different compilers.
• The object code (executable machine code) can be saved
and run without needing the compiler
Compiler
7. Compiler
Advantages Disadvantages
• Object code can be saved to disk and run
when required
• If an error have to recompile whole
program
• Executes faster • Will only run on a computer that has the
same platform
• Object code can be distributed or executed
without the compiler
• You cannot change the program without
going back to the source code
• Secure as object code cannot be read
without reverse engineering
• The translation is only done once and as a
separate process
• Compiled programs can run on any
computer
8. • An interpreter reads a statement of the source code
and immediately performs the required action.
• Once the programmer has written and saved a program
and instructs the computer to run it the interpreter looks
at each line in the source code analyses it and if there
no errors translates it into machine code.
Interpreter
9. Interpreter
Advantages Disadvantages
• Useful for program development as there is
no lengthy recompilation
• The program may run slower because
each statement has to be translated
every time it is encountered
• Easier to partially test and debug programs • Need to have the interpreter installed
(Interpreted programs can only run on
computers that have the interpreter)
• Can be run on different hardware platforms • Source code must be provided to users
• Easier to use
• You can interrupt it while it’s running,
change the program and either continue or
start again.
10. An instruction set used for
programming that can be executed
on any computer using a virtual
machine
(Definitions)
11. • Most interpreted languages (e.g. python or Java) use an
intermediate representation that combines compiling and
interpreting called bytecode
• This is an instruction set that can be executed using a virtual
machine (the bytecode interpreter) which emulates the
architecture of a computer.
• It is platform independent as long as the bytecode interpreter
is installed
• Bytecode can be either compiled once and for all (e.g. Java) or
each time the source code changes before execution (e.g.
python)
Bytecode