Computer Lang 2
Computer Lang 2
Computer Lang 2
Languages
9.1
91EVOLUTION
To write a program for a computer, we must use a
computer language. A computer language is a set of
predefined words that are combined into a program
according to predefined rules (syntax). Over the years,
computer languages have evolved from machine
language to high-level languages.
9.2
Machine languages
In the earliest days of computers, the only programming
languages available were machine languages. Each
computer had its own machine language, which was made of
streams of 0s and 1s. In Chapter 5 we showed that in a
primitive hypothetical computer, we need to use eleven lines
of code to read two integers, add them and print the result.
These lines of code, when written in machine language,
make eleven lines of binary code, each of 16 bits, as shown
in Table 9.1.
i
The only language understood by a computer is
machine language.
9.3
9.4
Assembly languages
The next evolution in programming came with the idea of
replacing binary code for instruction and addresses with
symbols or mnemonics. Because they used symbols, these
languages were first known as symbolic languages. The set
of these mnemonic languages were later referred to as
assembly languages.
The assembly language need a language processor called
Assembler to convert the assembly codes ( mnemonics
codes) into Machine Codes.
i
The only language understood by a computer is
machine language.
9.5
9.6
High-level languages
Although
assembly
languages
greatly
improved
programming efficiency, they still required programmers to
concentrate on the hardware they were using. Working with
symbolic languages was also very tedious, because each
machine instruction had to be individually coded. The desire
to improve programmer efficiency and to change the focus
from the computer to the problem being solved led to the
development of high-level languages.
Over the years, various languages, most notably BASIC,
COBOL, Pascal, Ada, C, C++ and Java, were developed.
Program 9.1 shows the code for adding two integers as it
would appear in the C++ language.
9.7
9.8
92TRANSLATION
Programs today are normally written in one of the highlevel languages. To run the program on a computer, the
program needs to be translated into the machine
language of the computer on which it will run. The
program in a high-level language is called the source
program. The translated program in machine language is
called the object program.
Two methods are used for translation: compilation and
interpretation. Thus, Compiler and Interpreter are two
of Language processor which converts HHL codes into
Machine Level.
9.9
Compilation
A compiler normally translates the whole source program
into the object program.
Interpretation
Some computer languages use an interpreter to translate the
source program into the object program. Interpretation refers
to the process of translating each line of the source program
into the corresponding line of the object program and
executing the line. Thus, Interpreter translates Line by Line
9.10
Translation process
Compilation and interpretation differ in that the first
translates the whole source code before executing it, while
the second translates and executes the source code a line at a
time. Both methods, however, follow the same translation
process shown in Figure 9.1.
93PROGRAMMINGPARADIGMS
Today, computer languages are categorized according to
the approach they use to solve a problem. A paradigm,
therefore, is a way in which a computer language looks
at the problem to be solved. We divide computer
languages into four paradigms: procedural, objectoriented, functional and declarative. Figure 9.2
summarizes these.
9.12
VeryHighLevelProgrammingLanguage
A very high-level programming language (VHLL) is a
programming language with a very high level of
abstraction, used primarily as a professional programmer
productivity tool.
Very high-level programming languages are usually
domain-specific languages, limited to a very specific
application, purpose, or type of task, and often
scripting languages (especially extension languages),
controlling a specific environment.
9.14
VeryHighLevelProgrammingLanguage
For this reason, very high-level programming languages
are often referred to as goal-oriented programming
languages.
Very high level language (VHLL) is a designed to
reduce the complexity and amount of source code
required to create a program.
An example of a very high-level programming language
is the scripting language, for Windows.
9.15
What is a Software?
Categories of Software
Categories of Software
System Software
A. Operating System (OS)
Operating System
( Continued..)
Features/Functions of OS
IO management
Data management
Process
management
File management
Security
Memory
management
Device
management
Command
Interpreter
Deadlock
Prevention
Time Sharing
Interrupt
Handling
System Software
B. Utility software
Utility
software
infrastructure
operating system,
usually
focuses
(including
on
the
application software
how
the
computer
computer hardware,
and
data
storage)
9.22
Utility software:
Examples
9.23
Application Software
A. Packaged Software
content management
inventory management
customer management
on