Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

programming language

and language
translators

Compiled by Prof. Anosha khan 1/14/2020


Programming language
 A programming language is a formal computer language or
constructed language designed to communicate instructions to a
machine, particularly a computer.
 Programming languages can be used to create programs to
control the behavior of a machine or to express algorithms.
 These are set of symbols characters and rules to write program
codes.
 It translates what a user wants to accomplish into a code that a
computer can understand and execute.
 Syntax: set of rules to write code

Compiled by Prof. Anosha khan 1/14/2020


Types of computer languages
 First generation language/ Machine Language/Low Level
language
 A first-generation programming language (1GL) is a machine-
level programming language.
 Originally, no translator was used to compile or assemble the
first-generation language.
 The first-generation programming instructions are in the form
of 0’s and 1’s. A computer programming language consisting of
binary or hexadecimal instructions which a computer can
respond to directly.
 No translator required.

Compiled by Prof. Anosha khan 1/14/2020


 Second generation language/ Assembly Language
 A second generation (programming) language (2GL) is a grouping of
programming languages associated with assembly languages.
 Unlike the first generation languages, programs can be written
symbolically, using English words (also known as mnemonics), in a way
that a human can understand and are subsequently converted into
machine language by an assembler.
 Assembly languages are specific to computer and CPU.
 Third Generation languages/High level languages
 A high-level language is a programming language such as C, FORTRAN,
BASIC, C++, Java or Pascal that enables a programmer to write programs
that are more or less independent of a particular type of computer.
 Such languages are considered high-level because they are closer to
human languages and far from machine languages so translator is
required.
Compiled by Prof. Anosha khan 1/14/2020
Third generation languages
 Procedural language
 It is a type of computer programming language that specifies a series of well-structured steps
and procedures within its programming context to compose a program.
 It contains a systematic order of statements, functions and commands to complete a
computational task or program.
 Structured programming
 It is a programming paradigm aimed at improving the clarity, quality, and development time of
a computer program by making extensive use of subroutines, block structures, for and while
loops—in contrast to using simple tests and jumps such as the goto statement which could lead
to "spaghetti code"
 Object-oriented programming (OOP)
 It is a programming language model organized around objects rather than "actions" and data
rather than logic.
 Historically, a program has been viewed as a logical procedure that takes input data, processes
it, and produces output data.
Compiled by Prof. Anosha khan 1/14/2020
 Fourth generation Language/ Non Procedural Language
 A computer language that does not require writing traditional
programming logic.
 Also known as a "declarative language," users concentrate on defining
the input and output rather than the program steps required in a
procedural programming language such as C++ or Java.
 It tells what to do but not how to do. Example Visual basic, SQL etc.

Compiled by Prof. Anosha khan 1/14/2020


Language Translator
 Source code
 Program written in high level language
 Object code
 Program written in low level language
 A translator is a computer program that performs the translation of a
program written in High level language into a low level language,
without losing the functional or logical structure of the original code.
 It converts the source code to object code.
 There are three types of language processors.
 Compiler
 Interpreter
 Assembler Source Language Object
Compiled by Prof. Anosha khan code translator 1/14/2020 code
 Compiler
 A compiler is a computer program (or a set of programs) that transforms source code
written in a programming language (the source language) into another computer language
(the target language), with the latter often having a binary form known as object code.
 It translate the whole program
 It generates object code
 Interpreter
 An interpreter is a computer program that directly executes, i.e. performs, instructions
written in a programming or scripting language, without previously compiling them into a
machine language program.
 It translate the program statement by statement
 It does not generate any object code
 Assembler
 Assembler (meaning one that assembles) may refer to: Assembler (computing), a computer
program which translates assembly language to an object file or machine language format.
Compiled by Prof. Anosha khan 1/14/2020
Difference Compiler & Interpreter
No Compiler Interpreter

1 Compiler Takes Entire program as Interpreter Takes Single instruction as


input input

2 Intermediate Object Code is No Intermediate Object Code is


Generated Generated

3 Conditional Control Statements are Conditional Control Statements are


Executes faster Executes slower
4 Memory Requirement : More Memory Requirement is Less

5 Program need not be compiled every Every time higher level program is
time converted into lower level program

6 Errors are displayed after entire Errors are displayed for every
program is checked instruction interpreted (if any)
7 Example : C Compiler Example : BASIC

Compiled by Prof. Anosha khan 1/14/2020


Debugger
 A debugger is a software program used to test and find bugs (errors) in other
programs.
 A debugger is also known as a debugging tool.
 A debugger is a computer program used by programmers to test and debug a target
program. Debuggers may use instruction-set simulators, rather than running a
program directly on the processor to achieve a higher level of control over its
execution.
 This allows debuggers to stop or halt the program according to specific conditions.
 However, use of simulators decreases execution speed.
 When a program crashes, debuggers show the position of the error in the target
program.
 Most debuggers also are capable of running programs in a step-by-step mode, besides
stopping on specific points.
 They also can often modify the state of programs while they are running.

Compiled by Prof. Anosha khan 1/14/2020


Loader
 A loader is a major component of an operating system that
ensures all necessary programs and libraries are loaded, which
is essential during the startup phase of running a program.
 It places the libraries and programs into the main memory in
order to prepare them for execution.
 Loading involves reading the contents of the executable file
that contains the instructions of the program and then doing
other preparatory tasks that are required in order to prepare
the executable for running, all of which takes anywhere from
a few seconds to minutes depending on the size of the
program that needs to run.
 Not all code and libraries are loaded at program startup, only
the ones required for actually running the program.
Other libraries are loaded as the program runs, or only as
 Compiled by Prof. Anosha khan 1/14/2020

required.
Loader
 The following are the responsibilities of a loader:
 Validate the program for memory requirements,
permissions, etc.
 Copy necessary files, such as the program image or
required libraries, from the disk into the memory
 Copy required command-line arguments into the stack
 Link the starting point of the program and link any other
required library
 Initialize the registers
 Jump to the program starting point in memory

Compiled by Prof. Anosha khan 1/14/2020


Information Processing cycle
 Data
A collection of raw facts and figures is called data. It may consist of
numbers, characters, symbols or pictures etc
 Information
Processed data is called information. It is more meaningful than data.
 Data processing is the re-structuring or re-ordering of data by people or
machine to increase their usefulness and add values for a particular
purpose.
 Data processing consists of the following basic steps - input, processing,
and output. These three steps constitute the data processing cycle.

Compiled by Prof. Anosha khan 1/14/2020


Information Processing Cycle
 Input
 Data is collected and given to the computer for
processing
 Process
 Computer process data to the required
information
 Output
 The information is given to the user as output
 Store
 Information is stored in the computer for
further use
Compiled by Prof. Anosha khan 1/14/2020

You might also like