Professional Documents
Culture Documents
Computer or Programming Languages are sets of words, symbols and codes used to write
programs. Different programming languages are available for writing different types of
programs. Some languages are specially used for writing business programming, others
are used for writing scientific program etc.
There are three types or levels of computer programming:
1. Machine language
Machine language
Machine Language is the actual bits used to control the processor in the computer,
usually viewed as a sequence of hexadecimal numbers (typically bytes). The processor
reads these bits in from program memory, and the bits represent "instructions" as to what
to do next. Thus machine language provides a way of entering instructions into a
computer (whether through switches, punched tape, or a binary file).
Machine Language instruction has two (2) parts. The first part is the operation code
which tells the computer what function to perform and the second part is the operand
which tells the computer where to find or store the data which is to be manipulated. A
programmer needs to write numeric codes for the instruction and storage location of data.
3. It is prone to errors
4. It is difficult to modify.
Low level programming languages are languages that will let you have direct access
on the machine resources (CPU Registers, Memory, I/O ports, etc)
1. Assembly Language
2. C (By comparing it to Assembly, It’s high level language but contains low level
features, so by many programmers it’s called portable assembly, and by comparing it
to scripting languages, it’s low level language)
3. We can add other languages that are similar to C or support low level features provided
by C, like C++, but remember that C++ comes with more high level features than C like
Object-Oriented, Better standard library, Templates, etc
So it depends not only on the language, but how we are using it.
Some programs written in C, don’t use the low level features, these programs looks like
it was written in high-level language, because in C we have the language constructs that
help in Abstraction too!
Assembly Language
Assembly (or assembler) language, often abbreviated as asm is a more human readable
view of machine language. Instead of representing the machine language as numbers, the
instructions and registers are given names (typically abbreviated words, or mnemonics,
eg ld means "load", ADD means addition, SUB means subtraction etc). Unlike a high
level language, assembly language is very close to the machine language that is why it is
also called symbolic machine code. The main abstractions (apart from the mnemonics)
are the use of labels instead of fixed memory addresses, and comments. Each assembly
language is specific to a particular computer architecture.
Example:
instead of using “1100 000”, we write the symbol ADD to mean the same thing(addition)
Assembler.
A disassembler performs the reverse function (although the comments and the names of
labels will have been discarded in the assembler process).
6. It is easily Modifiable
8. Memorability is high
3. It is easier to modify
4. Speed - Assembly language programs are generally the fastest programs around.
- Machine language created by compilers are usually longer and this makes
them slower.
7. Knowledge
- Your knowledge of assembly language will help you write better programs,
even when using HLLs.
High Level Languages are the types of computer programming languages close to human
languages, they are combinations of English language-like instructions such as input,
print etc and mathematical symbols. A program written in HLL are easier to write and
modify.
Each statement in a HLL is a micro instruction which is translated into several machine
language instructions.
1. Procedural Languages
3. Non-Procedural Languages
1. Procedural Programming languages Procedural programming are also known
as third generation language of 3G. in these language, program is a predefined set
of instructions. Computer executes these instructions in the same sequence in
which the instructions are written. Each instruction in this language tells the
computer what to do and how to do it. Some popular PL are: FORTRAN, BASIC,
COBOL, PASCAL, C etc
OOP is a technique in which programs are written on the basis of object. An object is a
collection of data and functions. Objects may represent a person, thing or place in real
world, in OOP, data and all possible functions on data are grouped together. Object
Oriented programs are easier to learn and modify. C++ and Java are popular Object
Oriented Language.
Characteristics of OOP
1. Object
2. Classes
6. Polymorphism
3. Non-Procedural Language
NPL are also known as fourth generation language or 4GL. In NPL, user only needs to
tell the computer “what to do” not “How to do it”. An important advantage of NPL is that
they can be used by NP user to perform a specific task. These languages accelerates
program process and reduce coding errors. 4GL are normally used in database application
and report generation. Some important non-procedural languages are as follows:
Execution modes
There are three general modes of execution for modern high-level languages:
Interpreted
When code written in a language is interpreted, its syntax is read and then
executed directly, with no compilation stage. A program called an interpreter
reads each program statement, following the program flow, then decides what to
do, and does it. A hybrid of an interpreter and a compiler will compile the
statement into machine code and execute that; the machine code is then discarded,
to be interpreted anew if the line is executed again. Interpreters are commonly the
simplest implementations of the behavior of a language, compared to the other
two variants.
Compiled
Note that languages are not strictly "interpreted" languages or "compiled" languages.
Rather, implementations of language behavior use interpretation or compilation. For
example, Algol 60 and Fortran have both been interpreted (even though they were more
typically compiled).
Assignment