A vocabulary and set of grammatical rules for instructing a computer to perform specific tasks. The term programming language usually refers to high-level languages, such as BASIC, C, C++, COBOL, FORTRAN, Ada, and Pascal. Each language has a unique set of keywords (words that it understands) and a special syntax for organizing program instructions.
Types of Programming Languages
Programming languages are divided into low-level languages and high-level languages.
Characteristics of low-level languages:
- a machine dependent language
- tedious and time consuming
- each instruction represents a single machine instruction.
There are two types of low-level languages:
- Machine language which is the lowest-level programming language (except for computers that utilize programmable microcode). Machine languages are the only languages understood by computers. While easily understood by computers, machine languages are almost impossible for humans to use because they consist entirely of numbers. Programmers, therefore, use either a high-level programming language or an assembly language.
- Assembly language which is a programming language that is once removed from a computer's machine language. Machine languages consist entirely of numbers and are almost impossible for humans to read and write. Assembly languages have the same structure and set of commands as machine languages, but they enable a programmer to use names instead of numbers.
Each type of CPU has its own machine language and assembly language, so an assembly language program written for one type of CPU won't run on another. In the early days of programming, all programs were written in assembly language. Now, most programs are written in a high-level language such as FORTRAN or C. Programmers still use assembly language when speed is essential or when they need to perform an operation that isn't possible in a high-level language.
Characteristics of high-level languages:
- Machine dependent language
- more user friendly and human understandable
- each instruction represents several machine instructions.
The Evolution of Higher-level Languages
The main advantage of high-level languages over low-level languages is that they are easier to read, write, and maintain. They also allow the programmer to work in a more English-like environment. There are three ‘generations’ of HLL and they are:-
- Third generation languages (3GLs) which are the first to use true English-like phrasing, making them easier to use than previous languages. They are also known as Procedural languages.
- Fourth-Generation Languages, often abbreviated 4GL, are programming languages closer to human languages than typical high-level programming languages. Most 4GLs are used to access databases. For example, a typical 4GL command is; FIND ALL RECORDS WHERE NAME IS “SMITH”.
- Fifth-Generation Languages (abbreviated 5GL) is a programming language based around solving problems using constraints given to the program, rather than using an algorithm written by a programmer. Most constraint-based and logic programming languages and some declarative languages are fifth-generation languages.
Compiling, Interpreting and Translation
A compiler is a program that translates source code into object code. The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instructions. Thus, a compiler differs from an interpreter, which analyzes and executes each line of source code in succession, without looking at the entire program. The advantage of interpreters is that they can execute a program immediately. Compilers require some time before an executable program emerges. However, programs produced by compilers run much faster than the same programs executed by an interpreter.
Every high-level programming language (except strictly interpretive languages) comes with a compiler. In effect, the compiler is the language, because it defines which instructions are acceptable.
Because compilers translate source code into object code, which is unique for each type of computer, many compilers are available for the same language. For example, there is a FORTRAN compiler for PCs and another for Apple Macintosh computers. In addition, the compiler industry is quite competitive, so there are actually many compilers for each language on each type of computer. More than a dozen companies develop and sell C compilers for the PC.
No comments:
Post a Comment