Classification of High Level Programming Languages: Procedural Language Functional Language Object Oriented Language
Classification of High Level Programming Languages: Procedural Language Functional Language Object Oriented Language
Procedural Language:
The most common high-level languages today are procedure-oriented languages. In these languages, one or more related blocks of statements that perform some complete function are grouped together into a program module, or procedure, & given a name such as Procedure A. If the same sequence of operations is needed elsewhere in the program, a simple statement can be used to refer back to the procedure. In essence, a procedure is just a mini-program. A large program can be constructed by grouping together procedures that perform different tasks. Procedural languages allow programs to be shorter and easier for the computer to read, but they require the programmer to design each procedure to be general enough to be used in different situations.
Functional Language:
Functional languages treat procedures like mathematical functions and allow them to be processed like any other data in a program. This allows a much higher and more rigorous level of program construction. Functional languages also allow variablessymbols for data that can be specified and changed by the user as the program is runningto be given values only once. This simplifies programming by reducing the need to be concerned with the exact order of statement execution, since a variable does not have to be redeclared, or restated, each time it is used in a program statement. Many of the ideas from functional languages have become key parts of many modern procedural languages.
Object-oriented languages are outgrowths of functional languages. In object-oriented languages, the code used to write the program and the data processed by the program are grouped together into units called objects. Objects are further grouped into classes, which define the attributes objects must have. A simple example of a class is the class Book. Objects within this class might be Novel and Short Story. Objects also have certain functions associated with them, called methods. The computer accesses an object through the use of one of the objects methods. The method performs some action to the data in the object and returns this value to the computer. Classes of objects can also be further grouped into hierarchies, in which objects of one class can inherit methods from another class. The structure provided in object-oriented languages makes them very useful for complicated programming tasks.
Logic Language:
There's also one more classification called as Logic Language.Logic languages use logic as their mathematical base. A logic program consists of sets of facts and if-then rules, which specify how one set of facts may be deduced from others, for example:If the statement X is true, then the statement Y is false.In the execution of such a program, an input statement can be logically deduced from other statements in the program. Many artificial intelligence programs are written in such languages.
Low Level Languages The languages which use only primitive operations of the computer are known as low language. In these languages, programs are written by means of the memory and registers available on the computer. As we all know that the architecture of computer differs from one machine to another, so far each type of computer there is a separate low level
programming language. In the other words, Programs written in one low level language of one, architectural cant be ported on any other machine dependent languages. Examples are Machine Language and Assembly Language. Machine Language In machine language program, the computation is based on binary numbers. All the instructions including operations, registers, data and memory locations are given in there binary equivalent. The machine directly understands this language by virtue of its circuitry design so these programs are directly executable on the computer withoutany translations. This makes the program execution very fast. Machine languages are also known as first generation languages. A typical low level instruction consists essentially of two parts: An Operation Part : Specifies operation to be performed by the computer, also known as Opcode.
An Address Part : Specifies location of the data on which operation is to be performed. Advantages Machine language makes most efficient use of computer system resources like storage, registers, etc. the instruction of a machine language program are directly executable so there is no need of translators. Machine language instruction can be used to manipulate the individual bits in a computer system with high execution speed due to direct manipulation of memory and registers. Drawbacks Machine languages are machine dependent and, therefore, programs are not portable from one computer to other. Programming in machine language usually results in poor programmer productivity. Machine languages require programmers to control the use of each register in the computers Arithmetic Logic Unit and computer storage locations must be addressed directly, not symbolically. Machine language requires a high level of programming skill which increases programmer training costs. Programs written in machine language are more error prone and difficult to debug because it is very difficult to
remember all binary equivalent of register, opcode, memory location, etc. program size is comparatively very big due to nonuse of reusable codes and use of very basic operations to do a complex computation. Assembly Language Assembly language are also known as second generation languages. These languages substitutes alphabetic or numeric symbols for the binary codes of machine language. That is, we can use mnemonics for all opcodes, registers and for the memory locations which provide us with a facility to write reusable code in the form of macros. Has two parts, one is macro name and the other is macro body which contains the line of instructions. A macro can be called at any point of the program by its name to use the instruction. A macro can be called at any point of the program by its name to use the instructions given in the macro repetitively. These language require a translator known as Assembler for translating the program code written in assembly language to machine language. Because computer can interpret only the machine code instruction, once the translation is completed the program can be executed.
Advantages Assembly language provide optimal use of computer resources like registers and memory because of direct use of these resources within the programs. Assembly language is easier to use than machine language because there is no need to remember or calculate the binary equivalents for opcode and registers. An assembler is useful for detecting programming errors. Assembly language encourages modular programming which provides the facility of reusable code, using macro. Drawbacks Assembly language programs are not directly executable due to the need of translation. Also, these languages are machine dependent and, therefore, not portable from one machine to another. Programming in assembly language requires a high level of programming skills and knowledge of computer architecture of the particular machine. High Level Languages (HLL) All high level language are procedure-oriented language and are intended to be machine independent. Programs are written in statements akin to English language, a great advantage over
mnemonics of assembly languages require languages use mnemonics of assembly language. That is, the high level languages use natural language like structures. These languages require translators (compilers and interpreters) for execution. The programs written in a high level language can be ported on any computer, that is why known they are known as machine independent. The early highlevel language come in third generation of languages, COBOL, BASIC, APL, etc. These languages enable the programmer to write instruction using English words and familiar mathematical symbols which makes it easier than technical details of the computer. It makes the programs more readable too. Procedures Procedures are the reusable code which can be called at any point of the program. Each procedure is defined by a name and set of instructions accomplishing a particular task. The procedure can be called by its name with the list of required parameters which should pass to tat procedure. Advantages of High Level Languages
These are the third generation languages. These are procedureoriented languages and are machine independent. Programs are written in English like statements. As high level languages are not directly executable, translators(compilers and interpreters) are used to convert them in machine language equivalent. Advantages 1)These are easier to learn than assembly language. 2)Les time is required to write programs. 3)These provides better documentation. 4)These are easier to maintain. 5)These have an extensive vocabulary. Limitation of Programming language 1)A long sequence statements is to be written for every program. 2)Additional memory space is required for storing compiler or interpreter. 3)Execution time is very high as the HLL programs are not directly executable. Kinds of procedural
Procedural programming languages include C, C++, Fortran, Pascal, and BASIC.[1]
Knowledge representation[edit]
The fact that Horn clauses can be given a procedural interpretation and, vice versa, that goal-reduction procedures can be understood as Horn clauses + backward reasoning means that logic programs combine declarative and procedural representations of knowledge. The inclusion of negation as failure means that logic programming is a kind of nonmonotonic logic. Despite its simplicity compared with classical logic, this combination of Horn clauses and negation as failure has proved to be surprisingly expressive. For example, it has been shown to correspond, with some further extensions, quite naturally to the semi-formal language of legislation. It is also a natural language for expressing common-sense laws of cause and effect, as in the situation calculusand event calculus.
Metalogic programming[edit]
Because mathematical logic has a long tradition of distinguishing between object language and metalanguage, logic programming also allows
metalevel programming. The simplest metalogic program is the so-called "vanilla" meta-interpreter: solve(true). solve((A,B)):- solve(A),solve(B). solve(A):- clause(A,B),solve(B). where true represents an empty conjunction, and clause(A,B) means there is an object-level clause of the form A :- B. Metalogic programming allows object-level and metalevel representations to be combined, as in natural language. It can also be used to implement any logic that is specified by means of inference rules.
logic, and they were used as the basis of the Japanese Fifth Generation Project (ICOT). However, the Prolog-like concurrent systems were based on message passing and consequently were subject to the same indeterminacy as other concurrent message-passing systems, such as Actors (see Indeterminacy in concurrent computation). Consequently, the ICOT languages were not based on logic in the sense that computational steps could not be logically deduced [Hewitt and Agha, 1988]. Concurrent constraint logic programming combines concurrent logic programming and constraint logic programming, using constraints to control concurrency. A clause can contain a guard, which is a set of constraints that may block the applicability of the clause. When the guards of several clauses are satisfied, concurrent constraint logic programming makes a committed choice to the use of only one.