The document discusses the life cycle of a source program from development to execution. It involves multiple phases including writing source code in a high-level language, preprocessing, compilation to object code, assembly, linking to create executable code, and loading and executing the program. Key parts of the life cycle include high and low-level languages, preprocessors, translators like compilers and interpreters, and linkers and loaders.
2. Life cycle of a souce program
• A computer program goes through many phases from its development to execution. From
the human readable format (source code) to binary encoded computer instructions
(machine code).
• In life cycle of a source program the exact procedure behind the compilation task and
step by step evaluation of source code are High level languages, Low level languages,
Pre-processors, Translators, Compilers, Assembler, Interpreters, Linkers and Loaders.
4. High level language
• High level languages are similar to the human language. Unlike low level languages, high
level languages are programmers friendly, easy to code, debug and maintain.
• High level language provides higher level of abstraction from machine language. They
do not interact directly with the hardware. Rather, they focus more on the complex
arithmetic operations, optimal program efficiency and easiness in coding.
• High level languages are very much closer to English language and uses English
structure for program coding.
• Examples of high level languages are Visual Basic, PHP, Python, Delphi, FORTRAN,
COBOL, C, Pascal, C++, LISP, BASIC etc.
High level language
Compiled Language
Interpreted
Language
5. Low level languages
• Low level languages are languages which can be directly understand by machines. It is
programming language having little or no abstraction. These languages are described as
close to hardware.
• Examples of low level languages are machine languages, binary language, assembly level
languages and object code etc.
Low level language
Assembley Language Machine Language
6. Source code
• Source code is a plain text file containing computer instructions written in human
readable format. It is simple text file written by programmers.
• It contain instructions in high-level language that the programmer intended to perform
by a program. Source code is later compiled and translated to Object code.
# include<stdio.h>
#include<conio.h>
void maid()
{
printf(“Hello Abhay”);
}
getch();
7. Object code
• Object code is a sequence of computer instructions in an intermediate language. It is generated
by compiler after the compilation process.
• The compiler reads source code written in high-level language and translates it to an
intermediate language.
• After translation a file containing instructions encoded in some intermediate language is
generated called object code.
101001010010
010101001010
101010001001
001110101001
110010010101
0010011011
# include<stdio.h>
#include<conio.h>
void maid()
{
printf(“Hello Abhay”);
}
getch();
Source Code Object Code
Compiler
8. Machine code
• Machine code is a set of computer instructions written or translated in machine
language.
• It is the final executable file generated by compiling, assembling or linking several
object files together. It is the only code executed by the CPU.
101001010010
010101001010
101010001001
001110101001
110010010101
0010011011
Machine Code
9. Pre-processor
• Pre-processor is a computer program that
manipulates its input data in order to generate
output which is ultimately used as input to some
other program or compiler.
• Input of pre-processor is high level languages and
output of pre-processor is pure high level
languages.
• Pure high level language refers to the language
which is having Macros in the program and File
Inclusion.
• Macro means some set of instructions which can
be used repeatedly in the program.
• Macro preprocessing task is done by pre-
processor. Pre-processor allows user to include
header files which may be required by program
known as File Inclusion.
Assembler
Linker/ Loader
Pre - processor
High level language
Pure High level language
Assembley Language
Executable Code
Machine Code
Compiler
10. Translator
• Translator is a program that takes input as a source program and converts it into another form as
output.
• Translator takes input as a high level language and convert it into low level language.
• There are mainly three types of translators -
Compilers
Assemblers
Interpreters
High level language
Translator
Low Level Language
Errors
11. Compiler
• Compiler reads whole program at a time and generate errors (if occurred). Compiler generates
intermediate code in order to generate target code. Once the whole program is checked, errors
are displayed.
• Example of compilers is Borland Compiler, Turbo C Compiler. Generated target code is easy to
understand after the process of compilation.
• The process of compilation must be done efficiently. There are mainly two parts of compilation
process.
Source Code
Error Message
Compiler Target code
12. Assembler
• Assembler is a translator which takes assembly language as an input and generates
machine language as an output.
• Output of compiler is input of assembler which is assembly language. Assembly code is
mnemonic version of machine code.
• Binary codes for operations are replaced by names. Binary language or relocatable
machine code is generated from the assembler.
• Assembler uses two passes. Pass means one complete scan of the input program.
High Leve Language
Assembler
Compiler
Low Level Language
Assembley language
Machine code
13. Interpreter
• Interpreter performs the line by line execution of source code. It takes single instruction
as an input, reads the statement, analyzes it and executes it. It shows errors immediately
if occur .
• Interpreter is machine independent andwhich does not produces object code or
intermediate code as it directly generates the target code.
• Many languages can be implemented using both compilers and interpreters such as
BASIC, Python, C#, Pascal, Java, and Lisp etc.
• Example of interpreter is UPS Debugger.
Source Code Interpreter Target code
14. Linker and Loader
•Linker combines two or more separate object
programs. It combines target program with other
library routines.
•Linker links the library files and prepares single
module or file. Linker also solves the external
reference.
•Linker allows us tocreate single program from
several files.
•Loader is utility program which takes object code as
input and prepares it for execution. It also loads the
object code into executable code.
•Loader refers to initializing of execution process.
Tasks done by loaders are mentioned below.
Allocation
Relocation
Link editing
Loading
LinkerAssembler
Loader
Object Code
Executable code
Source Code