2. Introduction to Programming
• A language that is acceptable to a computer
system is called a programming language or
computer language
• The process of creating sequence of
instructions in any programming language is
called programming or coding
• A program is a set of instructions written to
perform a specific task by the computer
• A set of large programs is called a software
2
3. Computer Languages
• A computer language is the main medium of
communication between the users and the
computer systems
• Every computer language is bounded by rules
known as syntax of the language
• The user is bound by the syntax while
communicating with the computer system
• All the available computer languages are
categorized into two basic types of languages:
– Low level language
– High level language
3
5. Low Level Language
• The term low level highlights the fact that this language
is closer to a language that the machine understands
• Low level languages are the machine codes in which
the instructions are given in machine language in the
form of 0 and 1 to a computer system
• The main function of the low level language is to
operate, manage and manipulate the hardware and
system components
• Low level language is also divided into two categories:
– Machine language
– Assembly language
5
6. Low Level Language
• Machine Language
• It is one of the low-level programming languages
which is the first generation language developed for
communicating with a Computer.
• It is written in machine code which represents 0 and 1
binary digits inside the computer string which makes
it easy to understand and perform the operations
• It is well known that a computer system can recognize
electric signals (0 stands for turning off electric pulse
and 1 stands for turning on electric pulse)
6
7. Low Level Language
• Advantages of Machine Language
– The main advantage of using Machine language is
that there is no need of a translator or interpreter to
translate the code, as the Computer directly can
understand
• Disadvantages of Machine Language
– The programmer have to remember the operation
codes, memory address every time you write a
program and also hard to find errors in a written
program
– It is a machine dependent and can be used by a single
type of computer
7
8. Low Level Language
• Assembly Language
– It is the second generation programming language
that has almost similar structure and set of commands
as machine language
– Instead of using numbers like in machine languages
here we use words or names in English and also
symbols for different operations
– The programs that have been written using words,
names and symbols in assembly language are
converted to machine language using an assembler
8
9. Low Level Language
• Advantages of Assembly Language
– The main advantage of using assembly language is its
speed that makes it the mostly used low level
language till today that is used by many programmers
• Disadvantages of Assembly Language
– The main disadvantage of this language is that it is
written only for a single type of CPU and does not run
on any other CPU (machine dependent)
9
10. High Level Language
• To overcome the limitation of low level languages, high
level language has evolved which uses normal English
and is easy to understand to solve any problem
• The high level languages are the most commonly used
that helps programmers to read, write and maintain code
• It is also considered as the third generation language that
is used by many programmers
• High level languages require a programming language
translator that can convert the high level language to
machine language
10
11. High Level Language
• Advantages:
– Programming with this kind of language is quite
easy and simple
– High level languages are computer independent
– Programs written in high level languages are
portable across multiple systems
11
12. High Level Language
• Some of the various high level languages are as given below:
– BASIC (Beginners All Purpose Symbolic Instruction Code): It
is widely used, easy to learn general purpose language. Mainly
used in microcomputers in earlier days.
– COBOL (Common Business Oriented language): A
standardized language used for commercial applications.
– FORTRAN (Formula Translation): Developed for solving
mathematical and scientific problems. One of the most
popular languages among scientific community
– C: Structured Programming Language used for all purpose
such as scientific application, commercial application,
developing games etc.
– C++: Popular object oriented programming language, used for
general purpose.
12
13. Programming Language Translators
• To make the machine understand the
instructions provided by both the languages,
programming language translators are used
• They transform the instructions written by
programmers into a form which can be
interpreted and executed by the computer.
• The various tools/programming language
translators used to achieve this purpose are:
– Compiler
– Interpreter
– Assembler
– Linker
13
15. Programming Language Translators
• Following are the various tools to achieve this
purpose:
– Compiler: The software that reads a program written
in high level language and translates it into an
equivalent program in machine language is called
as compiler.
– The program written by the programmer in high
level language is called source program and the
program in binary code (machine language) generated
by the compiler after translation is called as object
program.
15
17. Programming Language Translators
– Interpreter: It also coverts each high-level
program statement into the machine code.
– The interpreter takes 1 statement, translates it,
executes it and then again takes the next
statement.
17
18. Working of Interpreter and Assembler
• Both compiler and interpreters do the same job i.e.,
converting higher level programming language to
machine code but their method of execution is
different.
18
20. Programming Language Translators
– Assembler: The software that reads a program
written in assembly language and translates it into
an equivalent program in machine language is
called as assembler.
20
21. Programming Language Translators
• Linker: A linker or link editor is a computer program
that takes one or more object files generated by a
compiler and combines them into a single
executable file, library file, or another object file.
21
22. Loader
• In computer systems a loader is the part of an operating
system that is responsible for loading programs and
libraries.
• It is one of the essential stages in the process of starting
a program, as it places programs into memory and
prepares them for execution.
• Loading a program involves reading the contents of
the executable file containing the program instructions
into memory, and then carrying out other required
preparatory tasks to prepare the executable for running.
• Once loading is complete, the operating system starts the
program by passing control to the loaded program code.
22
24. Program Design Methods
• There are two approaches mainly followed for
program design:
– Top-down programming
– Bottom-up programming
• Top-down programming:
• It refers to a style of programming where an application is
constructed starting with a high-level description of what it
is supposed to do
• It then breaks the specification down into simpler and
simpler pieces, until a level has been reached that
corresponds to the primitives of the programming
language to be used
24
25. Program Design Methods
• Bottom-up programming:
• Bottom-up programming is the opposite of top-
down programming.
• It refers to a style of programming where an
application is constructed starting with existing
primitives of the programming language.
• It constructs gradually more and more
complicated features, until the all of the
application has been written.
25