0% found this document useful (0 votes)
138 views14 pages

Types of Programming Languages: 1. Low Level Language

There are two main types of programming languages: low-level languages and high-level languages. Low-level languages include machine language (1GL) and assembly language (2GL), which are closer to machine code and hardware. High-level languages include procedural languages (3GL), problem-oriented languages (4GL), and natural languages (5GL), which more closely resemble human languages. Programming languages can also be categorized based on their level of abstraction from hardware, with low-level languages being less abstract and high-level languages being more abstract.

Uploaded by

shishay Gebre
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
138 views14 pages

Types of Programming Languages: 1. Low Level Language

There are two main types of programming languages: low-level languages and high-level languages. Low-level languages include machine language (1GL) and assembly language (2GL), which are closer to machine code and hardware. High-level languages include procedural languages (3GL), problem-oriented languages (4GL), and natural languages (5GL), which more closely resemble human languages. Programming languages can also be categorized based on their level of abstraction from hardware, with low-level languages being less abstract and high-level languages being more abstract.

Uploaded by

shishay Gebre
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 14

Types of Programming Languages

There are two types of programming languages, which can be categorized into the following
ways:
1. Low level language
A. Machine language (1GL)
B. Assembly language (2GL)
2. High level language
A. Procedural-Oriented language (3GL)
B. Problem-Oriented language (4GL)
C. Natural language (5GL)
1. Low level language
This language is the most understandable language used by computer to perform its operations. It
can be further categorized into:
A. Machine Language (1GL)
Machine language consists of strings of binary numbers (i.e. 0s and 1s) and it is the only one
language, the processor directly understands. Machine language has an Merits of very fast
execution speed and efficient use of primary memory.
Merits:
 It is directly understood by the processor so has faster execution time since the programs
written in this language need not to be translated.
 It doesn’t need larger memory.
Demerits:
 It is very difficult to program using 1GL since all the instructions are to be represented by
0s and 1s.
 Use of this language makes programming time consuming.
 It is difficult to find error and to debug.
 It can be used by experts only.
B. Assembly Language
Assembly language is also known as low-level language because to design a program
programmer requires detailed knowledge of hardware specification. This language uses
mnemonics code (symbolic operation code like ‘ADD’ for addition) in place of 0s and 1s. The
program is converted into machine code by assembler. The resulting program is referred to as an
object code.
Merits:
 It is makes programming easier than 1GL since it uses mnemonics code for
programming. Eg: ADD for addition, SUB for subtraction, DIV for division, etc.
 It makes programming process faster.
 Error can be identified much easily compared to 1GL.
 It is easier to debug than machine language.
Demerits:
 Programs written in this language is not directly understandable by computer so
translators should be used.
 It is hardware dependent language so programmers are forced to think in terms of
computer’s architecture rather than to the problem being solved.
 Being machine dependent language, programs written in this language are very less or
not portable.
 Programmers must know its mnemonics codes to perform any task.
2. High level language
Instructions of this language closely resembles to human language or English like words. It uses
mathematical notations to perform the task. The high level language is easier to learn. It requires
less time to write and is easier to maintain the errors. The high level language is converted into
machine language by one of the two different languages translator programs; interpreter or
compiler.
High level language can be further categorized as:
A. Procedural-Oriented language (3GL)
Procedural Programming is a methodology for modeling the problem being solved, by
determining the steps and the order of those steps that must be followed in order to reach a
desired outcome or specific program state. These languages are designed to express the logic and
the procedure of a problem to be solved. It includes languages such as Pascal, COBOL, C,
FORTAN, etc.
Merits:
 Because of their flexibility, procedural languages are able to solve a variety of problems.
 Programmer does not need to think in term of computer architecture which makes them
focused on the problem.
 Programs written in this language are portable.
Demerits:
 It is easier but needs higher processor and larger memory.
 It needs to be translated therefore its execution time is more.
B. Problem-Oriented language (4GL)
It allows the users to specify what the output should be, without describing all the details of how
the data should be manipulated to produce the result. This is one step ahead from 3GL. These are
result oriented and include database query language.
Eg: Visual Basic, C#, PHP, etc.
The objectives of 4GL are to:
Ø Increase the speed of developing programs.
Ø Minimize user’s effort to obtain information from computer.
Ø Reduce errors while writing programs.
Merits:
 Programmer need not to think about the procedure of the program. So, programming is
much easier.
Demerits:
 It is easier but needs higher processor and larger memory.
 It needs to be translated therefore its execution time is more.
C. Natural language (5GL)
Natural language are still in developing stage where we could write statements that would look
like normal sentences.
Merits:
 Easy to program.
 Since, the program uses normal sentences, they are easy to understand.
 The programs designed using 5GL will have artificial intelligence (AI).
 programs would be much more interactive and interesting.
Demerits:
 It is slower than previous generation language as it should be completely translated into
binary code which is a tedious task.
 Highly advanced and expensive electronic devices are required to run programs
developed in 5GL. Therefore, it is an expensive approach.

Characteristics of a programming Language

 A programming language must be simple, easy to learn and use, have good
readability and human recognizable.
 Abstraction is a must-have Characteristics for a programming language in which
ability to define the complex structure and then its degree of usability comes.
 A portable programming language is always preferred.
 Programming language’s efficiency must be high so that it can be easily converted
into a machine code and executed consumes little space in memory.
 A programming language should be well structured and documented so that it is
suitable for application development.
 Necessary tools for development, debugging, testing, and maintenance of a program
must be provided by a programming language.
 A programming language should provide single environment known as Integrated
Development Environment (IDE).
 A programming language must be consistent in terms of syntax and semantics.

There is five generation of Programming languages. They are:

 First Generation Languages :


These are low-level languages like machine language
 Second Generation Languages :
These are low-level assembly languages used in kernels and hardware drives
 Third Generation Languages :
These are high-level languages like C, C++, Java, Visual Basic and JavaScript
 Fourth Generation Languages:
These are languages that consist of statements that are similar to statements similar
to statements in the human language. These are used mainly in database
programming and scripting. Example of these languages includes Perl, Python, Ruby,
SQL
 Fifth Generation Languages:
These are the programming languages that have visual tools to develop a program.
Examples of fifth generation language include Mercury, OPS5, and Prolog

The first two generations are called low level languages. The next three generations are
called high level languages.
Low Level Vs High Level programming languages
1) Platform Dependencies

First, you should know about the platform, here platform means Computer Hardware (Computer
configuration).

Low Level programming languages are platform dependent that means programs written in Low
Level language can run on the same hardware with same configuration, you cannot run them on
hardware that has different configuration.

High Level programming languages are platform independent that means programs written in
High Level language can run on different hardware with different configuration.

Remember: High Level programming languages are platform independent that doesn’t mean
they are operating system independent. System hardware configuration may be different but
Operating systems should be same.

2) Speed

Low Level language programs are faster than High Level language programs as they do not need
to convert.

They have less number of syntaxes, functions, keywords, class libraries.

3) Easiness

Low Level language programs are not as easy as High Level language. There are only two Low
Level programming languages Binary and Assembly. Binary has only 0’s, 1’s, while Assembly
has some difficult type symbols which are knows as mnemonics.

But, the High Level languages programs are easy to write, read, modify and understand.

4) Performance

Since, Low Level Languages programs are faster, so performance of Low Level languages
programs are better than the High Level languages programs.

5) Translation

Low Level language Binary does not need translation as Binary codes are Machine codes and
computer understands them without any translations.

Assembly needs an Assembler to translate an Assembly program to its equivalent


Binary/Machine Code.
High Level Languages are translated by the compilers or interpreters; sometimes (in case of
some programming languages) both are required to get the Object/Binary file.

6) Flexibilities

High Level languages are flexible to read, edit, debug, understand etc but Low Level Languages
are not so easy to handle.

High Level languages have huge libraries with a rich set of Data types, keywords, functions etc
so these languages are really good to develop an application with many great features using less
effort and resource.

7) Support

Low Level languages have less support than High Level Languages. There may be lesser number
of professionals (community) in support of Low Level languages as comparisons to High Level
Language support.
These are the different types of programming languages translators with their merits and
demerits.

Assembler
An assembler translates assembly language into machine code. Assembly language consists of
mnemonics for machine opcodes so assemblers perform a 1:1 translation from mnemonics to a
direct instruction. For example:

LDA #4 converts to 0001001000100100

Conversely, one instruction in a high level language will translate to one or more instructions at
machine level.

Advantages of using an Assembler:

Very fast in translating assembly language to machine code as 1 to 1 relationship


Assembly code is often very efficient (and therefore fast) because it is a low level language
Assembly code is fairly easy to understand due to the use of English-like mnemonics

Disadvantages of using Assembler:

Assembly language is written for a certain instruction set and/or processor


Assembly tends to be optimized for the hardware it's designed for, meaning it is often
incompatible with different hardware
Lots of assembly code is needed to do relatively simple tasks, and complex programs require
lots of programming time

Compiler
A Compiler is a computer program that translates code written in a high level language to a
lower level language, object/machine code. The most common reason for translating source code
is to create an executable program (converting from a high level language into machine
language).

Advantages of using a compiler

Source code is not included, therefore compiled code is more secure than interpreted code
Tends to produce faster code than interpreting source code
Produces an executable file, and therefore the program can be run without need of the source
code
Disadvantages of using a compiler

Object code needs to be produced before a final executable file, this can be a slow process
The source code must be 100% correct for the executable file to be produced

Interpreter
An interpreter program executes other programs directly, running through program code and
executing it line-by-line. As it analyses every line, an interpreter is slower than running compiled
code but it can take less time to interpret program code than to compile and then run it — this is
very useful when prototyping and testing code. Interpreters are written for multiple platforms,
this means code written once can be run immediately on different systems without having to
recompile for each. Examples of this include flash based web programs that will run on your PC,
MAC, games console and Mobile phone.

Advantages of using an Interpreter

Easier to debug (check errors) than a compiler


Easier to create multi-platform code, as each different platform would have an interpreter to
run the same code
Useful for prototyping software and testing basic program logic

Disadvantages of using an Interpreter

Source code is required for the program to be executed, and this source code can be read
making it insecure
Interpreters are generally slower than compiled programs due to the per-line translation
method
What is Translators? Different type of translators
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

The different types of translator are as follows:

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.
It directly executes the operations specified in the source program when the input is given by the
user.

It gives better error diagnostics than a compiler.

Differences between compiler and interpreter

SI. Compiler Interpreter


No
1 Performs the translation of a program as Performs statement by statement
a whole. translation.
2 Execution is faster. Execution is slower.
3 Requires more memory as linking is Memory usage is efficient as no
needed for the generated intermediate intermediate object code is generated.
object code.
4 Debugging is hard as the error messages It stops translation when the first
are generated after scanning the entire error is met. Hence, debugging is
program only. easy.
5 Programming languages like C, C++ Programming languages like Python,
uses compilers. BASIC, and Ruby uses interpreters.

Assembler

Assembler is a translator which is used to translate the assembly language code into machine
language code.
A translator is a programming language processor that converts a computer program from one language
to another. It takes a program written in source code and converts it into machine code. It discovers and
identifies the error during translation.

Purpose of Translator
It translates high-level language program into a machine language program that the central
processing unit (CPU) can understand. It also detects errors in the program.

Different Types of Translators


There are 3 different types of translators as follows:

Compiler

A compiler is a translator used to convert high-level programming language to low-level


programming language. It converts the whole program in one session and reports errors detected
after the conversion. Compiler takes time to do its work as it translates high-level code to lower-
level code all at once and then saves it to memory.
A compiler is processor-dependent and platform-dependent. But it has been addressed by a
special compiler, a cross-compiler and a source-to-source compiler. Before choosing a compiler,
user has to identify first the Instruction Set Architecture (ISA), the operating system (OS) and the
programming language that will be used to ensure that it will be compatible.

Interpreter

Just like a compiler, is a translator used to convert high-level programming language to low-level
programming language. It converts the program one at a time and reports errors detected at
once, while doing the conversion. With this, it is easier to detect errors than in a compiler. An
interpreter is faster than a compiler as it immediately executes the code upon reading the code.
It is often used as a debugging tool for software development as it can execute a single line of
code at a time. An interpreter is also more portable than a compiler as it is not processor-
dependent, you can work between hardware architectures.

Assembler

An assembler is is a translator used to translate assembly language to machine language. It is


like a compiler for the assembly language but interactive like an interpreter. Assembly language
is difficult to understand as it is a low-level programming language. An assembler translates a
low-level language, an assembly language to an even lower-level language, which is the machine
code. The machine code can be directly understood by the CPU.
Examples of Translators
Here are some examples of translators per type:

Translator Examples
Microsoft Visual Studio
Compiler GNU Compiler Collection (GCC)
Common Business Oriented Language (COBOL)
OCaml
Interpreter List Processing (LISP)
Python
Fortran Assembly Program (FAP)
Assembler Macro Assembly Program (MAP)
Symbolic Optimal Assembly Program (SOAP)

Advantages and Disadvantages of Translators


Here are some advantages of the Compiler:

 The whole program is validated so there are no system errors.


 The executable file is enhanced by the compiler, so it runs faster.
 User do not have to run the program on the same machine it was created.

Here are some disadvantages of the Compiler:

 It is slow to execute as you have to finish the whole program.


 It is not easy to debug as errors are shown at the end of the execution.
 Hardware specific, it works on specific machine language and architecture.

Here are some advantages of the Interpreter:

 You discover errors before you complete the program, so you learn from your mistakes.
 Program can be run before it is completed so you get partial results immediately.
 You can work on small parts of the program and link them later into a whole program.

Here are some disadvantages of the Interpreter:

 There’s a possibility of syntax errors on unverified scripts.


 Program is not enhanced and may encounter data errors.
 It may be slow because of the interpretation in every execution.
Here are some advantages of the Assembler:

 The symbolic programming is easier to understand thus time-saving for the programmer.
 It is easier to fix errors and alter program instructions.
 Efficiency in execution just like machine level language.

Here are some disadvantages of the Assembler:

 It is machine dependent, cannot be used in other architecture.


 A small change in design can invalidate the whole program.
 It is difficult to maintain.

Programming languages Example

Ada, Algol, BASIC or Basic, C, C++, C#, COBOL or Cobol, FORTH or Forth, FORTRAN or Fortran,
Haskell, Java, LISP, LOGO, Pascal, Perl, PL/1, Postscript, PROLOG or Prolog, RPG, Simula, Smalltalk,
SNOBOL, SQL

These compiled computer programming languages include:

 Visual Basic
 Delphi
 C
 C++
 C#
 Cobol
 Fortran
 Objective-C
 Swift
 Pascal
 Python

Popular interpreted computer programming languages include:

 Javascript
 Perl
 PHP
 Postscript
 Python
 Ruby
Translators

Computers only understand machine code (binary), this is an issue because programmers prefer
to use a variety of high and low-level programming languages instead.

To get around the issue, the high-level and low-level program code (source code) needs to pass
through a translator. A translator will convert the source code into machine code (object code).

There are several types of translator programs, each able to perform different tasks.

Compiler

Compilers are used to translate a program written in a high-level language into machine code
(object code).

Once compiled (all in one go), the translated program file can then be directly used by the
computer and is independently executable.

Compiling may take some time but the translated program can be used again and again without
the need for recompilation.

An error report is often produced after the full program has been translated. Errors in the
program code may cause a computer to crash. These errors can only be fixed by changing the
original source code and compiling the program again.

Interpreter
Interpreter programs are able to read, translate and execute one statement at a time from a high-
level language program.

The interpreter stops when a line of code is reached that contains an error.

Interpreters are often used during the development of a program. They make debugging easier as
each line of code is analyzed and checked before execution.

Interpreted programs will launch immediately, but your program may run slower then a complied
file.

No executable file is produced. The program is interpreted again from scratch every time you
launch it.

Assembler
Assemblers are used to translate a program written in a low-level assembly language into a
machine code (object code) file so it can be used and executed by the computer.

Once assembled, the program file can be used again and again without re-assembly.

Summary of translators
Compiler Interpreter Assembler
Translates high-level languages Temporarily executes high-level Translates low-level assembly
into machine code languages, one statement at a code into machine code
time
An executable file of machine No executable file of machine An executable file of machine
code is produced (object code) code is produced (no object code is produced (object code)
code)
Compiled programs no longer Interpreted programs cannot be Assembled programs no longer
need the compiler used without the interpreter need the assembler
Error report produced once Error message produced One low-level language
entire program is immediately (and program stops statement is usually translated
compiled. These errors may at that point) into one machine code
cause your program to crash instruction
Compiling may be slow, but the Interpreted code is run through
resulting program code will run the interpreter (IDE), so it may
quick (directly on the processor) be slow, e.g. to execute program
loops
One high-level language
statement may be several lines
of machine code when compiled

You might also like