3.5 EDITOR, ASSEMBLER, INTERPRETOR & COMPILER
To write a program in any of the programming languages requires an editor.
This is a program that is used to create text files. While saving the program,
filename and extension as per programming language is required to be given e.g
in C programming language f1.c, in C++ f1.cpp or f1.C, in Java f1.java etc. The
extension may also depend on the conventions of the operating system used, for
instance, in unix the extension for a C++ program is .C while for Windows it
would be .cpp.
There are different types of editors. Some of the programming languages have
some specific built in editors.
A Programming Language is different from machine language, which is
understood by a computer in the sense that it can be directly executed. Hence a
program in any higher level programming language like C requires a translation
process that can translate the source program into machine code so that it can be
executed by the computer.
As you may already know from a previous unit, programming languages can be
low level languages or high level languages.
Assembly language is a low level programming language similar to machine
language, but far easier to write and understand because machine language binary
instructions and operands are replaced by mnemonics that are comprehensible to
humans. Just As a program written in programming language requires a translator
to translate the source program in machine code, a program written in assembly
language uses the utility named as assembler for translation purpose. Assembly
language is the most basic programming language available for any processor.
With assembly language, a programmer works only with operations implemented
directly on the physical CPU. Assembly language lacks high-level conveniences
such as variables and functions, and it is not portable between various families of
processors.
- Good readability
- Easy software development
Hence Programming languages translators are broadly divided into two
categories:
- Compilers
- Interpreters
Compiled Language : An additional program called a compiler translates a
program written in a programming language; into a new file that does not require
any other program to execute itself, such a file is called an executable.
e.g. C, C++, Pascal are languages that are typically compiled
Compilers produce better optimized code that generally runs faster and compiled
code is self-sufficient and can be run on their intended platforms without the
compiler present.
Interpreter : An interpreter is a program that translates each statement in the
programming language into machine code and runs it. Such an arrangement
means that to run the program one must always have the interpreter available.
e.g Basic , Prolog, Perl are languages that are typically interpreted.
Programs in any language can be interpreted or compiled. So there are basic
compilers available as well. Compiled code runs faster and does not need the
compiler at run time, whereas interpreted code is slower and needs the interpreter
every time the program has to be run.
Check Your Progress 2👈
1) What is the need of programming language?
…………………………………………………………………………………..
…………………………………………………………………………………..
…………………………………………………………………………………..
2) What is the purpose of looping statement s in a programming language?
…………………………………………………………………………………..
…………………………………………………………………………………..
…………………………………………………………………………………..
3) What are basic operators in any of the programming language?
…………………………………………………………………………………..
…………………………………………………………………………………..
4) What is the purpose of using an array in a programming language?
…………………………………………………………………………………..
…………………………………………………………………………………..
…………………………………………………………………………………..
ANSWERS TO CHECK YOUR PROGRESS
Check Your Progress 1
1. a) Algorithm to calculate area of a rectangle
Step 1: Read length of the rectangle.
Step 2: Read breadth of the rectangle.
Step 3: Calculate Area = length X breadth
Step 4: Print area.
Step 5: END
1. b) Algorithm to find sum of the first n numbers
Step 1: read the number (n)
Step 2: initialize fact=1,i=1
Step 3: repeat 4,5 until i<=n
Step 4: fact=fact+i
Step 5: increment i by 1 i.e i=i+1
Step 10: Print “Sum of n given numbers is”, n , fact
Step 11: END
Check Your Progress 2
1. To solve any problem computer has to be given instructions. Instructions
cannot be given in any natural language, which we use (like English, Hindi
etc). So it is required to have a programming language to write the
program to solve the given problem with the help of a computer.
2. If in a program, a set of statements has to be executed more than once at a
particular place, then looping statements are used.
3. The operators in any programming language are broadly classified into the
following types:
a) Arithmetic operators: Operators, which are used to perform
arithmetic operations such as addition, subtraction, multiplication,
division etc.
b) Logical Operators: Operators under this category are AND, OR,
NOT
c) Relational Operators : >,<,=, not = ,<=, >= these are the relational
operators.
4. In programming, when large amount of related data need to be processed
and each data element is stored with different variable name, it becomes
very difficult to manage and manipulate. To deal with such situations, the
concept of array is used. Array provides a simple & efficient method to
refer, retrieve & manipulate a collection of similar data by a single name.