8.Computer Language
8.Computer Language
Introduction
• Human languages are known as natural languages.
◦ Unfortunately, computers can not understand natural languages (English, Gujarati, Spanish,..
etc),
◦ as a result we must communicate with computers using computer languages (programming
languages)
• Programming languages can be used to create programs that control the behavior
of a computer and serve any purpose
◦ A programming language is a set of rules that provides a way of telling a computer what
operations to perform.
Introduction
• English is a natural language. It has words, symbols and grammatical rules.
• A programming language also has words, symbols and rules of grammar.
• The grammatical rules are called syntax.
• Each programming language has a different set of syntax rules.
Levels of Programming Languages
Architecture
• Computer understand only binary
language (0 or 1) .
• Binary language also known as
machine or low level language
Assembly High-level
Machine Language
Language Language
Low-level languages
Generations of Programming Languages
• Computer languages has the same history as the computers itself history,
• There are five generations of languages when programming method and techniques
could be developed as far as development in hardware occurred.
First Generation (1GL) – Machine Language
• First-generation language was machine language
◦ the level of instructions and data that the processor is actually given to work on binary numbers
0s and 1s.
• In the 1940s and 1950s, computers were programmed by scientists sitting before control
panels equipped with toggle switches so that they could input instructions as strings of
zeros and ones.
(1GL) – Machine Language
• Machine language Format
◦ Operation code – instruct computer what functions are to be performed (such as addition or
subtraction).
◦ Operands – instruct the computer where to find or store the data on which the desired
operation is to be performed
• Machine language is machine dependent as it is the only language the computer can
understand.
◦ Very efficient code but very difficult to write.
(1GL) – Machine Language
• Advantages:
1. Translation Free:
◦ computer can directly execute without the need for conversion
2. High Speed:
◦ Since no conversion is needed, applications developed using machine languages are extremely
fast
◦ Ex. Space control system, nuclear reactors and chemical processing
(1GL) – Machine Language
• Disadvantages:
1. Machine Dependent
◦ Based on computer architecture,
◦ application developed for one type of computer may not run on others
2. Complex Language
◦ Difficult to read and write
3. Error Prone
◦ Since programmer has to remember all the opcode and the memory locations, it is bound to be error
prone
4. Tedious
◦ Programming becomes too complex to modify
Second Generation (2GL) – Assembly Language
• By the late 1950s, this language had become popular.
Machine Language
Program
Assembly Program
(Source Code) Assembler
Error Messages (if
any)
Second Generation (2GL) – Assembly Language
• Advantages:
• Machine Dependent
◦ Different computer have their own assembly languages
• Harder to learn
• Slow development time
• Less efficient
• No standardization
• No support for modern software engineering technology
Third Generation (3GL)-High-level Language
• Closer to English but included simple mathematical notation.
• Programmer do not need to know how computer works in detail.
• Programmer can write program by learning syntax of language.
• High level language must use interpreter, compiler or translator to convert human
understandable program to computer readable code (machine code).
Third Generation (3GL)-High-level Language
• Many high level languages have appeared since Fortran II the most widely used have
been:
Results of the
Translates and expected statement
High-level Language
program (Source code) Executes Statement
by Statement
Error Messages (if
any)
Refer online resources to list out the difference between Compiler, Interpreter and Assembler.
Linker
• An application usually consists hundreds, thousands or even million of lines of code
• Code divided into logical groups and stored into different modules
◦ So debugging and maintenance becomes easy
◦ Each module can be modified and compiled independently
◦ Linker links several object modules and libraries to form a single program
Linker
Source file Compiler Object file
Executable
Source file Compiler Object file Linker
file
1. Query Languages: allow user to retrieve information from databases (ex. SQL)
2. Report Generators: produce customized reports using data stored into databse
3. Application Generators: the user writes programs to allow data to be entered into the database
Fourth Generation (4GL)
• Advantage:
◦ User can create an application in a much shorter time for development and debugging than with
other programming languages
• Disadvantage:
◦ Program need more disk space and large memory capacity compared to 3GL program
Fifth Generation Languages (5GL)
• Though no clear definition at present, natural language programs generally can be
interpreted and executed by the computer with no other action by the user than stating
their question.
• User will free from learning any programming language to communicate with computes
• Programmers may simply type the instruction or tell the computer via microphones what
is needs to do
• Limited capabilities at present.
Thank You.