You are on page 1of 3

3/7/2022

Programming language
Overview of Programming  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

Programming language(Cont.) Programming language(Cont.)


 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.) Programming language(Cont.)


1)Machine level language 2)Assembly language
 Computers are made of two-state electronic  It uses mnemonic codes such as ADD for addition, SUB
components which can understand only pulse and no- for subtraction etc.
pulse (1 and 0) conditions.  Memory locations containing data are given names
 It consist of string of binary numbers(0 and 1). such as TOTAL, MARKS, TIME etc.
 faster program execution  Thus, instead of referring a location using its number, it
 It is very tedious to understand and remember the can be referred using the name given to it.
various combinations of 1’s and 0’s representing data  A program written in assembly language must be
and instructions. translated into machine language before it can be
 Every computer has its own machine language, the executed. This translation is done by another program
programmer can not communicate with other computers called assembler.
if he does not know its machine language.

1
3/7/2022

Programming language(Cont.) Programming language(Cont.)


 Advantages of assembly language over machine 3) Procedure oriented language (High level)
language:  This language consists of a set of words and symbols
 It saves programmer’s time. and one can write programs using these in conjunction
 Fewer errors are made. with certain pre-specified rules of the language.
 They are easier to modify than machine language  A programming language such as C, FORTRAN,
programs. 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.

Programming language(Cont.) Programming language(Cont.)


 Ultimately, programs written in a high-level language 4) Fourth generation language
must be translated into machine language by a  A non-procedural programming language that requires
compiler or interpreter. less coding than lower-level languages.
 faster program development  Eg. Command-line languages, database management
 It takes extra time for conversion and thus are less systems (DBMSs). Prolog, an artificial
efficient as compared to machine language programs. intelligence language that applies rules to data to
arrive at solutions

Language translators Language translators(Cont.)


 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 Compiler Interpreter
memory for execution. It checks whole program at It checks program one by
 Interpreter: which analyzes and executes each line of a stretch. one.
source code without looking at the entire program. It throws all errors in a It throws errors of a single
program. line.
It is faster. It is slower.
It is less accurate. It is more accurate.
C, C++ uses it. Java uses it.

2
3/7/2022

Errors Files generated by compiler


 Types:  Sample.c //source code
1)Syntax error:  Sample.obj //machine language
• It occurs due to poor knowledge of programming  Sample.bak //backup file
language.  Sample.exe //auto executable file
• 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 */
}

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?

You might also like