Here is list of artificial intelligence languages: 1. Declarative Vs. Procedural Language 2. Smalltalk Language 3. POP (POP-11) Language.
1. Declarative Vs. Procedural Language:
In procedural programming (in languages like Pascal, Basic) we tell the computer what do to and exactly how to do it. This is done through specific instructions given to the machine in the program.
A typical example of Procedural approach (Pascal) is:
J = 1;
ADVERTISEMENTS:
For 1: = 1 to 10
begin
J: = (J*1)/1;
write (J)
ADVERTISEMENTS:
end;
We specify the iterations, the calculation and the variable T assignments through each iteration.
In contrast, in declarative programming (in Prolog), we merely describe or declare the problem and it is upto the computer to find the solution. What is implied here that it is actually the language which takes care of telling the computer just to find a solution or perform a task.
A typical Prolog program is:
Here, Prolog will infer from the given facts and rules that Mary likes John; though we did not tell Prolog what and how to do it. We just described the facts and relationships and asked a question based upon those facts and relationships. Declarative programming emphasises static facts and rules; the procedural details are hidden in the inference mechanism. In this respect, it meets one of the goals of the fifth generation language design.
The distinction between procedural and declarative language can not be carried too far: there is a trade off between the two styles of programming-efficiency is achieved at the cost of reliability.
By telling the computer how to obtain a solution, we introduce complexities in the program, thereby reducing the reliability of the result. When should we select the declarative vs. procedural approach depends a lot upon the situation. Also it should be kept in mind that Prolog is not purely a declarative language, though it leans more towards declarative language.
2. Smalltalk Language:
Some of the distinguishing features of Smalltalk-V are presented briefly here. We begin by defining some of the basic elements of the language and how these elements interact.
ADVERTISEMENTS:
a. Object:
The standard-definition of objects is a package of information and descriptions of its manipulation. Another definition states that an object is a package of data and procedures which belong together. The only elements of Smalltalk which are not objects are message selectors, comments, and punctuation characters. While conventional languages cleanly distinguish data from the procedures which operate on it, a Smalltalk object consists of both the knowledge-base and procedures which operate on it.
b. Message:
Sending a message in Smalltalk is the equivalent of invoking a procedure or operator in conventional language. Computation is performed by sending messages to objects. The message includes a message selector (procedure name) and its operands. The result of sending a message to an object is to generate another object as the answer or value. The Smalltalk equivalent of the LISP read-evaluate-print cycle is the specify-object, send-it-message, receive-resulting-object cycle.
ADVERTISEMENTS:
c. Method:
The Smalltalk method is the equivalent of the body of a conventional language subroutine or procedure. It is a description of the sequence of actions to be taken when a message is received by an object.
It consists of three parts:
i. A message pattern (procedure name containing a selector)
ii. Temporary variable names
iii. List of expressions.
Smalltalk punctuation requires separating these three parts by vertical bars (|) and separating expressions by a period (.).
d. Class:
The class is the fundamental Smalltalk data structure describing one or more similar objects. A new object is described (by creating its class) before it is actually constructed. This is done by creating a basic class template, a framework with slots which are filled in to create the object.
The slot names include the following quantities:
i. Class name
ii. Instance variable names
iii. Methods
By filling the slots for a particular object with its characteristic set of instance variables we create an instance of the object.
e. Inheritance:
The Smalltalk class structure provides the feature of inheritance. Inheritance is a very efficient scheme for knowledge representation in which objects share all the attributes of their class and all classes of which they are sub-classes.
Class structure relationships may be:
i. Sub-Class:
A class of objects which is a specialisation of the general class.
ii. Super-Class:
A class of objects created to generalise a group of classes.
iii. Meta-Class:
A class which describes a class as an object. The single instance of the class is itself a class.
f. Method Dictionary:
The method dictionary contains pairs of selectors and methods. When a message is sent to an object, the method dictionary for that class is scanned for the appropriate method to execute. A method dictionary is included in every class description.
3. POP (POP-11) Language:
POP-11 is a powerful general purpose programming language designed originally by Robin Popplestone of Edinburgh University. Developed as a tool for artificial intelligence research and teaching, its use has spread to graphics, image processing, expert system design, and VLSI circuit design.
It is the core language of POP LOG, an integrated, interactive software development environment which includes LISP, Prolog and a series of increment compilers and editors. POPLOG provides an environment in which programs written in Pascal, FORTRAN, C, and POP-11 can be integrated and linked dynamically.
POP-11 resembles LISP in its sophistication but has a richer, syntax. This makes it a better teaching language than LISP. It encourages writing well-structured, clear programs in the style of Pascal with modular, testable parts.
Program editing, documentation, compilation, linking, and testing all use the same process which speeds up program development time. Because of the large environment it provides, POPLOG requires minicomputers or workstations with one or more megabytes of memory.
Features of POP-11:
1. Syntax:
The syntax of POP-11 falls into two general categories:
i. Expressions referring to objects,
ii. Imperatives referring to actions.
The objectives defined in POP-11 include, among other, simple data types such as numbers, words, strings, and lists. Imperatives result in POP-11 actions-which may create objects, compare, search, store, and print out objects.
For example, a simple imperative to add two numbers is written as:
25 + 75 -→;;; This is the print arrow.
and POP-11 responds
** 100
To assign a variable, Grade, a value, we would write:
92 → Grade;
Note the Pascal-like semicolon usage and the reversal of the usual algorithmic language assignment arrow direction. Comments are indicated by three semicolons on a, single line or multi-line comments enclosed by /*… */.
Variable and constant declarations also closely resemble Pascal, but without the strict typing Pascal requires.
To declare x, y, and z as object, we write:
vars x, y, z;
Constant may be declared and assigned a single value only:
constant City;
‘Kurukshetra’ _ City;
Lists are assigned, using the […] list delimiters as:
vars List 1;
[a b c d e f] → List 1;
Procedure definitions resemble those of LISP without the parentheses:
define cute (anything);
anything→ anything →
end define;
which can be invoked to yield:
cute [Happy Birthday to You]
** [Happy Birthday to You]
** [Happy Birthday to You]
2. Stack Operation:
While all languages make use of a stack for keeping track of such things as calls to procedures, POP-11 gives the programmer direct access to a “user stack”. The stack performs as a push-down array with the first element on being the last off.
We can, for instance, assign x, y, and i the values 10,20 and 30 respectively with the multiple assignment statement:
10, 20, 30→ z → y → x;
To interchange the value of two variables on the stack, we type:
X, y → x → y;
which is more efficient than the three-way rotation required in other languages. Stack manipulation is very straight-forward,
vars y;
25, 50, 75; ;;; put three numbers on stack
→ x, ;;; pull the top one off and assign to x
→;;; print the stack
** 25, 50 ;;; first two numbers are left on stack
There are several intrinsic functions provided by POP-11 for manipulating the stack. These include:
StackLength () ;;; counts # of items, n, on stack, puts n on top
Erase ;;; removes one item from the top of the stack
Erasenum (n) ;;; erases n items from the stack
ClearStack ;;; removes everything from the stack
Subscr_stack (n) ;;; returns or updates the nth item on the stack
3. Program Control, Iteration and Recursion:
POP-11 supports essentially all standard conditionals and control of flow structures.
The general form of some of these structures are shown next:
if <condition> then <action 1> else <action 2> endif
until <condition> do <action> enduntil
while <condition> do <action> endwhile
repeat <expression> times <action> endrepeat
for <x> in <list> do <action> endfor
In addition to these standard forms, there are several variations which provide efficient program control for almost any conceivable application.
4. Pattern Matching:
Pattern matching is one of the most important tasks in many artificial intelligence applications. POP-11 provides very natural and powerful pattern matching procedures.
The pattern matcher follows the general syntax:
<List> matches <pattern>
POP-11 provides many other features which make it an excellent language for AI research and teaching. Space does not permit a complete summary, but the segments of code presented above should give an indication of the natural syntax and power of the language.
In conclusion, we have surveyed four of the major languages available for investigations in artificial intelligence. Other languages have come and gone during the history of AI, but; these four have survived and continue.