2. Programming language
The set of instruction written in a programming
language is called program.
Two types:
1) Application Program: Program which direct the
computer to solve the problem of user.
eg. Word, excel, games etc
2) System Program: Program which direct the
computer to solve the problem of computer itself.
eg. OS, antivirus software etc
3. To communicate with a computer it has to be instructed
to carry out various tasks like: what operations to
perform, how to present results, when and how to make
certain decisions and so on.
These set of instructions have to be communicated to
the computer through a language called ‘programming
language’.
Levels of programming language:
1)Machine language(low level)
2)Assembly language
3)Procedure oriented language(high level)
4)Fourth generation language(4GLs)
Programming language(Cont.)
5. Programming language(Cont.)
1)Machine level language
Computers are made of two-state electronic
components which can understand only pulse and no-
pulse (1 and 0) conditions.
It consist of string of binary numbers(0 and 1).
faster program execution
It is very tedious to understand and remember the
various combinations of 1’s and 0’s representing data
and instructions.
Every computer has its own machine language, the
programmer can not communicate with other computers
if he does not know its machine language.
6. 2)Assembly language
It uses mnemonic codes such as ADD for addition, SUB
for subtraction etc.
Memory locations containing data are given names
such as TOTAL, MARKS, TIME etc.
Thus, instead of referring a location using its number, it
can be referred using the name given to it.
A program written in assembly language must be
translated into machine language before it can be
executed. This translation is done by another program
called assembler.
Programming language(Cont.)
7. Advantages of assembly language over machine
language:
It saves programmer’s time.
Fewer errors are made.
They are easier to modify than machine language
programs.
Programming language(Cont.)
8. Programming language(Cont.)
3) Procedure oriented language (High level)
This language consists of a set of words and symbols
and one can write programs using these in conjunction
with certain pre-specified rules of the language.
A programming language such as C, FORTRAN,
or Pascal that enables a programmer to
write programs that are independent of a particular type
of computer.
It is machine independent and a program written in high
level language can be run on different computers with
little or no modification.
The main advantage of high-level languages over low-
level languages is that they are easier to read, write,
and maintain.
9. Ultimately, programs written in a high-level language
must be translated into machine language by a
compiler or interpreter.
faster program development
It takes extra time for conversion and thus are less
efficient as compared to machine language programs.
Programming language(Cont.)
10. Programming language(Cont.)
4) Fourth generation language
A non-procedural programming language that requires
less coding than lower-level languages.
Eg. Command-line languages, database management
systems (DBMSs). Prolog, an artificial
intelligence language that applies rules to data to
arrive at solutions
11. Language translators
Compiler: It checks the entire program and if error free,
produces a complete program in machine
language(object code).Then object code is loaded in
memory for execution.
Interpreter: which analyzes and executes each line of
source code without looking at the entire program.
12. Compiler Interpreter
It checks whole program at
a stretch.
It checks program one by
one.
It throws all errors in a
program.
It throws errors of a single
line.
It is faster. It is slower.
It is less accurate. It is more accurate.
C, C++ uses it. Java uses it.
Language translators(Cont.)
13. Errors
Types:
1)Syntax error:
• It occurs due to poor knowledge of programming
language.
• Eg. you may miss a semicolon or a curly bracket.
2) Logical error:
• it occurs due to poor knowledge of programming
technique.
• A logic error, or bug, is when your program compiles
and runs, but does the wrong thing.
• int average(int a, int b)
{
return a + b / 2; /* should be (a + b) / 2 */
15. Q & A
1) A machine language program consist of instructions
written in..?
2) An Assembly language program consist of instructions
written in..?
A)mnemonic
B)0’s and 1’s
C)Keywords
D)English like words
3) Translator that translates the assembly language into
machine language is called..?
4) int a=10, b=0, c;
c=a/b; //syntax error or logical error?