Language Processors: Assembler, Compiler and Interpreter
Language Processors: Assembler, Compiler and Interpreter
Language Processors: Assembler, Compiler and Interpreter
Language Processors – Assembly language is machine dependent yet mnemonics that are being
used to represent instructions in it are not directly understandable by machine and high Level
language is machine independent. A computer understands instructions in machine code, i.e. in
the form of 0s and 1s. It is a tedious task to write a computer program directly in machine code.
The programs are written mostly in high level languages like Java, C++, Python etc. and are
called source code. These source code cannot be executed directly by the computer and must be
converted into machine language to be executed. Hence, a special translator system software is
used to translate the program written in high-level language into machine code is called
Language Processor and the program after translated into machine code (object program /
object code).
1. Compiler –
The language processor that reads the complete source program written in high level
language as a whole in one go and translates it into an equivalent program in machine
language is called as a Compiler.
Example: C, C++, C#, Java
Assembler-
The Assembler is used to translate the program written in Assembly language into machine code. The
source program is a input of assembler that contains assembly language instructions. The output
generated by assembler is the object code or machine code understandable by the computer.
Interpreter-
The translation of single statement of source program into machine code is done by language processor
and executes it immediately before moving on to the next line is called an interpreter. If there is an error
in the statement, the interpreter terminates its translating process at that statement and displays an
error message. The interpreter moves on to the next line for execution only after removal of the error.
An Interpreter directly executes instructions written in a programming or scripting language without
previously converting them to an object code or machine code.
Example: Perl, Python and Matlab.
Difference between Compiler and Interpreter –
Compiler Interpreter
A compiler is a program which coverts the entire interpreter takes a source program and
source code of a programming language into runs it line by line, translating each line
executable machine code for a CPU. as it comes to it.
Compiler takes large amount of time to analyze the Interpreter takes less amount of time to
entire source code but the overall execution time of the analyze the source code but the overall
program is comparatively faster. execution time of the program is slower.
Compiler generates the error message only after
Its Debugging is easier as it continues
scanning the whole program, so debugging is
translating the program until the error is
comparatively hard as the error can be present any
met
where in the program.
No intermediate object code is
Generates intermediate object code.
generated.
Examples: C, C++, Java Examples: Python, Perl
Algorithm : Systematic logical approach which is a well-defined, step-by-step procedure that allows a
computer to solve a problem.
Pseudocode : It is a simpler version of a programming code in plain English which uses short phrases to
write code for a program before it is implemented in a specific programming language.
Program : It is exact code written for problem following all the rules of the programming language.
Advantage:
Disadvantage:
Imperative programming is divided into three broad categories: Procedural, OOP and parallel processing.
These paradigms are as follows:
This paradigm emphasizes on procedure in terms of under lying machine model. There is no difference
in between procedural and imperative approach. It has the ability to reuse the code and it was boon at
that time when it was in use because of its reusability.
Examples of Procedural programming paradigm:
Advantages:
Data security
Inheritance
Code reusability
Flexible and abstraction is also present
Parallel processing is the processing of program instructions by dividing them among multiple
processors. A parallel processing system posses many numbers of processor with the objective of
running a program in less time by dividing them. This approach seems to be like divide and conquer.
Examples are NESL (one of the oldest one) and C/C++ also supports because of some library function.
Declarative programming paradigm:
It can be termed as abstract model of computation. It would solve logical problems like
puzzles, series etc. In logic programming we have a knowledge base which we know
before and along with the question and knowledge base which is given to machine, it
produces result. In normal programming languages, such concept of knowledge base is
not available but while using the concept of artificial intelligence, machine learning we
have some models like Perception model which is using the same mechanism.
The functional programming paradigms has its roots in mathematics and it is language
independent. The key principal of this paradigms is the execution of series of mathematical
functions. The central model for the abstraction is the function which are meant for some
specific computation and not the data structure. Data are loosely coupled to functions.The
function hide their implementation. Function can be replaced with their values without
changing the meaning of the program. Some of the languages like perl, javascript mostly uses
this paradigm.
Symbolic programming
In computer programming, symbolic programming is a programming paradigm in which the program can
manipulate its own formulas and program components as if they were plain data. Through symbolic
programming, complex processes can be developed that build other more intricate processes by
combining smaller units of logic or functionality. Thus, such programs can effectively modify themselves
and appear to "learn", which makes them better suited for applications such as artificial intelligence,
expert systems, natural language processing, and computer games. Languages that support symbolic
programming include homoiconic languages such as Wolfram Language, LISP and Prolog.