Sei sulla pagina 1di 9

INTRODUCTION TO PRORAMMING

LANGUAGE

CHAPTER 1.2
Fundamentals of Programming
Language

DFC1023 PROBLEM SOLVING & PROGRAM DESIGN


FUNDAMENTALS OF PROGRAMMING
LANGUAGES
 Definitions of :
 Programmer
 someone who write program or computer software
 The term computer programmer can refer to a specialist in
one area of computer programming or to a generalist
who writes code for many kinds of software
 Program
 guide the computer through orderly sets of actions
 is a sequence of instructions, written to perform a
specified task with a computer
 Programming
 The action or process of writing computer programs
LANGUAGE TRANSLATORS
 A program is a set of instructions for performing a
particular task. These instructions are just like English
words. The computer interprets the instructions as 1's
and 0's.
 A program can be written in assembly language as
well as in high-level language. This written program
is called the source program. The source program is
to be converted to the machine language, which is
called an object program.
 A translator is required for such a translation.
LANGUAGE TRANSLATORS
 Assembler :
 Anassembler translates the symbolic codes of
programs of an assembly language into machine
language instructions
 The assembler programs translate the low-level
language to the machine code. The translation job is
performed either manually or with a program called
assembler.
LANGUAGE TRANSLATORS
 Compiler
 translate all the instructions of the program into machine
codes, which can be used again and again
 The program, which is to be translated, is called the source
program and after translation the object code is generated.
 The entire program will be read by the compiler first and
generates the object code.
 Compiler scans the entire program once and then converts it
into machine language
 In short compiler translates the entire program in one go
and then executes it
 Compiler generates error report after translation of entire
code
LANGUAGE TRANSLATORS
 Interpreter
 The interpreter generates object codes for the source
program.
 Interpreter first converts high level language into an
intermediate code and then executes it line by line. This
intermediate code is executed by another program.
 The execution of program is faster in compiler than
interpreter as in interpreter code is executed line by
line.
ANALOGY OF COMPILER AND
INTERPRETER
 Consider an English speaker wishes to communicate with a French
speaker? There are two possible solutions to the problem:
 The English speaker employs an interpreter who translates the
English sentences into French as they are spoken. The English
speaker says a sentence in English, the interpreter hears it,
translates it in his/her brain into French, and the speaks the
sentence in French. This is repeated for each sentence. Progress is
slow: there are pauses between sentences as the translation
process takes place.
 The English speaker writes down (in English) what needs to be said.
The whole document is then translated into French, producing
another piece of paper with the French version written on it.
LANGUAGE TRANSLATORS
 Syntax
 rules and principles that govern the sentence structure of
any individual language
 Syntax error
 a syntax error is an error in the syntax of a sequence of
characters that is intended to be written in a
particular programming language.
 For compiled languages syntax errors occur strictly
at compile-time. A program will not compile until all syntax
errors are corrected.
 For interpreted languages, however, not all syntax errors
can be reliably detected until run-time.
PROGRAMMING LANGUAGE
APPLICATION IN REAL LIFE
 Exercise
 Give one example of programming languages
application in real life.

Potrebbero piacerti anche