There are many types of programming languages .
Example: C++, VB.NET, Java, Python, Assembly.
HIERARCHY OF PROGRAMMING LANGUAGES:
HIERARCHY OF PROGRAMMING LANGUAGES:
LEVELS OF COMPUTER LANGUAGE
•Lower Level Language
•High level Language
1. LOWER LEVEL LANGUAGE
- In computer science, a low-level programming language is a programming language that provides little or no abstraction from a computer's instruction set architecture—commands or functions in the language map closely to processor instructions.
- Generally this refers to either machine code or assembly language.
- The word "low" refers to the small or nonexistent amount of abstraction between the language and machine language; because of this, low-level languages are sometimes described as being "close to the hardware."
- Because of the close relationship between the language and the hardware architecture programs written in low-level languages tend to be relatively non-portable.
- Low-level languages can convert to machine code without a compiler or interpreter— second generation programming languages use a simpler processor called an assembler— and the resulting code runs directly on the processor.
- Low-level programming languages are sometimes divided into two categories: first generation, and second generation.
LOWER LEVEL LANGUAGES CAN BE DIVIDED INTO:
1. Machine code
- It is the only language a computer can process directly without a previous transformation.
- Currently, programmers almost never write programs directly in machine code, because it requires attention to numerous details that a high-level language handles automatically, requires memorizing or looking up numerical codes for every instruction, and is extremely difficult to modify.
- True machine code is a stream of raw, usually binary, data.
- A programmer coding in "machine code" normally codes instructions and data in a more readable form such as decimal, octal, or hexadecimal which is translated to internal format by a program called a loader or toggled into the computer's memory from a front panel.
2. An assembly language (or assembler language)
- It is a low-level programming language for a computer, or other programmable device, in which there is a very strong (generally one-to-one) correspondence between the language and the architecture's machine codeinstructions.
- Each assembly language is specific to a particular computer architecture, in contrast to most high-level programming languages, which are generally portable across multiple architectures, but require interpreting or compiling.
2. HIGHER LEVEL LANGUAGE
- In computer science, a high-level programming language is a programming language with strong abstraction from the details of the computer.
- In comparison to low-level programming languages, it may use natural language elements, be easier to use, or may automate (or even hide entirely) significant areas of computing systems (e.g. memory management), making the process of developing a program simpler and more understandable relative to a lower-level language. The amount of abstraction provided defines how "high-level" a programming language is.
- In the 1960s, high-level programming languages using a compiler were commonly called autocodes. Examples of autocodes are COBOL and Fortran.
HISTORY
- The first high-level programming language designed for computers was Plankalkül, created by Konrad Zuse. However, it was not implemented in his time, and his original contributions were (due to World War II) largely isolated from other developments, although it influenced Heinz Rutishauser's language "Superplan" (and to some degree also Algol).
- The first really widespread high-level language was Fortran, a machine independent development of IBM's earlier Autocode systems. Algol, defined in 1958 and 1960, by committees of European and American computer scientists, introduced recursion as well as nested functions under lexical scope. It was also the first language with a clear distinction between value and name-parametersand their corresponding semantics.
- Algol also introduced several structured programming concepts, such as the while-do and if-then-else constructs and its syntax was the first to be described by a formal method, Backus–Naur Form (BNF).
- During roughly the same period Cobol introduced records (also called structs) and Lisp introduced a fully general lambda abstraction in a programming language for the first time.
FEATURES
- "High-level language" refers to the higher level of abstraction from machine language.
- High-level languages deal with variables, arrays, objects, complex arithmetic or boolean expressions, subroutines and functions, loops, threads, locks, and other abstract computer science concepts, with a focus onusability over optimal program efficiency.
- High-level languages have few, if any, language elements that translate directly into a machine's nativeopcodes.
- Other features, such as string handling routines, object-oriented language features, and file input/output, may also be present.
ADVANTAGES
- Instructions are much easier to remember and use than assembly language instructions.
- High-level programs are much easier to understand than assembly language ones.
- Fewer instructions are required to write a program than when using assembly language.
- A program can usually be developed much more quickly using a high level language than an assembly language.
- A program written in a high level language on one type of computer can usually be converted to operate on another type of computer quite easily. Because of this high level language programs are described as being portable.
DISADVANTAGES
- High-level language programs normally take up more space and execute more slowly than equivalent assembly language programs.
DIFFERENCE BETWEEN LOWER AND HIGHER LEVEL LANGUAGES :
LOWER LEVEL HIGHER LEVEL
1. A program written in a low-level An equivalent program in
language can be made to run very a high-level language can
quickly. be less efficient.
2. Small memory footprint. Use more memory.
3. High development time. Low development time.
4. Difficult to use due to numerous Isolates execution semantics
technical details that the of a computer architecture
programmer must remember. from the specification of the program, which simplifies development.
5. Easy to write and edit. Difficult to write and edit.
GENERATIONS OF COMPUTER
LANGUAGES:
FIRST GENERATION
- The first generation program language is pure machine code, that is just ones and zeros, e.g..
- Programmers have to design their code by hand then transfer it to a computer by using a punch card, punch tape or flicking switches. There is no need to translate the code and it will run straight away.
BENEFITS:
1. Code can be fast and efficient.
2. Code can make use of specific processor features such as special registers.
DRAWBACKS:
1. Code cannot be ported to other systems and has to be rewritten.
2. Code is difficult to edit and update.
3. Writing in 1s and 0s all day will leave you prone to mistakes.
3. Writing in 1s and 0s all day will leave you prone to mistakes.
SECOND GENERATION LANGUAGES
- Second-generation programming languages are a way of describing Assembly code.
- By using codes resembling English, programming becomes much easier.
- The usage of these mnemonic codes such as
LDA
for load andSTA
for store means the code is easier to read and write. - To convert an assembly code program into object code to run on a computer requires an Assembler and each line of assembly can be replaced by the equivalent one line of object (machine) code:
Assembly Code | Object Code | |
---|---|---|
LDA A
ADD #5
STA A
JMP #3
|
-> Assembler ->
|
000100110100
001000000101 001100110100 010000000011 |
- Assembly code has similar benefits to writing in machine code, it is a one to one relationship after all. This means that assembly code is often used when writing low level fast code for specific hardware.
- Until recently machine code was used to program things such as mobile phones, but with the speed and performance of languages such as C being very close to Assembly, and with C's ability to talk to processor registers, Assembly's use is declining.
BENEFITS
1. Code can be fast and efficient
2. Code can make use of specific processor features such as special registers
3. As it is closer to plain English, it is easier to read and write when compared to machine code
DRAWBACKS
1. Code cannot be ported to other systems and has to be rewritten
THIRD GENERATION (HIGH LEVEL LANGUAGES)
- Even though Assembly code is easier to read than machine code, it is still not straightforward to perform loops and conditionals and writing large programs can be a slow process creating a mish-mash of go to statements and jumps.
- Third-generation programming languages brought many programmer-friendly features to code such as loops, conditionals, classes etc. This means that one line of third generation code can produce many lines of object (machine) code, saving a lot of time when writing programs.
- Imperative languages - code is executed line by line, in a programmer defined sequence.
- Extension: Programming Paradigms :There are several types of Third-generation languages that users use . They include: Object Orientated , Event driven.
- Third generation (High Level Languages) codes are imperative. Imperative means that code is executed line by line, in sequence.
EXAMPLE
1
dim x as integer
2
x = 3
3
dim y as integer
4
y = 5
5
x = x + y
6
console.writeline(x)
Would output: 8
- Third generation languages can be platform independent, meaning that code written for one system will work on another. To convert a 3rd generation program into object code requires a Compiler or an Interpreter.
To summarise:
1. Hardware independence, can be easily ported to other systems and processors
2. Time saving programmer friendly, one line of 3rd gen is the equivalent of many lines of 1st and 2nd gen
However Code produced might not make the best use of processor specific features unlike 1st and 2nd generation.
FORTH GENERATION
- Fourth-generation languages are designed to reduce programming effort and the time it takes to develop software, resulting in a reduction in the cost of software development.
- They are not always successful in this task, sometimes resulting in inelegant and hard to maintain code.
- Languages have been designed with a specific purpose in mind and this might include languages to query databases (SQL), languages to make reports (Oracle Reports) and languages to construct user interface (XUL). An example of 4th generation programming type is the declarative language.
Example
Of a Structured Query Language (SQL) to select criminal details from a database :
SELECT name, height, DoB FROM criminals WHERE numScars = 7;
Declarative languages - describe what computation should be performed and not how to perform it. Not imperative!
An example of a declarative language is CSS which you might learn more about when completing any web design unit
/*code to change the headings on a page to green and the paragraphs to red and italic*/
h1 { color : #00FF00; }
p { color : #FF0000; font-style : italic }