You are on page 1of 14

High and Low Level

Languages
Computer Program
A computer program is a list of
instructions that enable a computer
to perform a specific task.
Computer programs can be written
in high and low level languages,
depending on the task and the
hardware being used.
High Level Languages
High level languages are written in a form that is close
to our human language, enabling to programmer to
just focus on the problem being solved.
No particular knowledge of the hardware is needed
as high level languages create programs that are
portable and not tied to a particular computer or
microchip.
These programmer friendly languages are called ‘high
level’ as they are far removed from the machine
code instructions understood by the computer.
Examples:
C++, Java, Pascal, Python, Visual Basic.
Advantages:
– Easier to modify as it uses English like
statements
– Easier/faster to write code as it uses English
like statements
– Easier to debug during development due to
English like statements
– Portable code – not designed to run on just
one type of machine
Low Level Languages
Low level languages are used to write programs
that relate to the specific architecture and
hardware of a particular type of computer.
They are closer to the native language of a
computer (binary), making them harder for
programmers to understand.
Examples of low level language:
 Assembly Language
 Machine Code
Assembly Language
Few programmers write programs in low level assembly
language, but it is still used for developing code for
specialist hardware, such as device drivers.
It is easy distinguishable from a high level language as it
contains few recognisable human words but plenty
of mnemonic code.
Advantages
– Can make use of special hardware or special machine-
dependent instructions (e.g. on the specific chip)
– Translated program requires less memory
– Write code that can be executed faster
– Total control over the code
– Can work directly on memory locations
Machine Code
They are also called as Binary code.  All
programs need to be translated into machine
code before a computer can understand and
execute them.
Programmers rarely write in machine code as
it is difficult to understand.
Advantage
The only advantage is that program of
machine language run very fast because no
translation program is required for the CPU.
Disadvantages
– It is very difficult to program in machine language.
The programmer has to know details of hardware
to write program.
– The programmer has to remember a lot of codes
to write a program which results in program
errors.
– It is difficult to debug the program.
Translator
A program written in high-level language is called as source
code. To convert the source code into machine code,
translators are needed.
A translator takes a program written in source language as
input and converts it into a program in target language as
output.
It also detects and reports the error during translation.
Roles of translator are:
• Translating the high-level language program input into an
equivalent machine language program.
• Providing diagnostic messages wherever the programmer
violates specification of the high-level language program.
Different type of translators:
• Compiler- Compiler is a translator which is used to convert
programs in high-level language to low-level language. It
translates the entire program and also reports the errors
in source program encountered during the translation.
• Interpreter- Interpreter is a translator which is used to
convert programs in high-level language to low-level
language. Interpreter translates line by line and reports
the error once it encountered during the translation
process.
• Assembler- Assembler is a translator which is used to
translate the assembly language code into machine
language code.
Types of Errors
• Syntax errors: errors due to the fact that
the syntax of the language is not
respected.
• Semantic errors: errors due to an
improper use of program statements.
• Logical errors: errors due to the fact that
the specification is not respected.
From the point of view of when
errors are detected, we distinguish:
– Compile time errors: syntax errors and
static semantic errors indicated by the
compiler.
– Runtime errors: dynamic semantic
errors, and logical errors, that cannot
be detected by the compiler
(debugging).
Homework
1. What happens when a compiler finds a syntax
error?
2. What happens when an interpreter finds a
syntax error?
3. What is an IDE?
4. Give three disadvantages of using a compiler
rather than an interpreter.
5. Give three advantages of using a compiler rather
than an interpreter.

You might also like