Turbo prolog
programming
It is a trade-mark of
Borland international Inc.
- The name ‘prolog’ is
taken from ‘programming in logic’
- Originally developed in
1972 by
Alain Colmerauer &
P.Roussel,
Book Reference :
Introduction to turbo prolog by Carl Townsend,BPB Publictions, ISBN
81-7029-104-6
Power of
prolog :
- It is OO-language like
LISP
- Use heuristic to solve
problems
- Most efficient at formal
reasoning
- Systems developed &
maintained by Knowledge engineers
- Interactive & cyclic
development
Features of Turbo
Prolog
- Compilation is
possible
- Std. predicates are
available for many functions like string operations, random file access, cursor
control, graphics, windowing & sound effects, like turbo
pascal
- Functional interface to
other languages - possible
- Declared variables for
security
- integer, real arithmetic
- possible
- An integrated editor for
compilation, development and debugging- all very easy.
Starting Turbo
prolog
c>PROLOG
Then the user-friendly
editor appears as follows:-
Run
Compile Edit Options Files Setup
Quit | ||
Editor Line1 Col1 Indent Insert
Work.pro |
----Dialog----- | |
--------Message--------- |
--------Trace---------- | |
Use first letter of Option
or select with -> or <-
Create a Sample
program
1.Select Edit mode &
enter program
2.
Enter text or corrections
as necessary
3.
Save the program to
disk
4.
Compile the
program
5.
Execute the
program
Edit operations : REFER
BOOK
Similar to Turbo
pascal
SAMPLE TEST
PROGRAM
Run
Compile Edit Options Files Setup
Quit | ||
Editor Line1 Col1 Indent Insert
Work.pro /* SAMPLE TEST
PROGRAM */ predicates
likes(symbol ,
symbol) clauses
likes(frank,sue).
likes(Harold,ruth). |
----Dialog----- | |
--------Message--------- |
--------Trace---------- | |
F1:Help F3:Search F4:Subst
F5:Copy F6:Move F7:del F8:ExtEdit F9:ExtCopy F10:End
Starting to execute the
program
To compile and execute the
program exit the editor
using Esc
or F10. Then select the
Run option
from the main
menu.
If NO errors, then see the
prompt
in dialog box as
follows:-
If error, turbo prolog
will return
to the ditor.
Then compile again till
‘No error’
SAMPLE TEST
PROGRAM
Run Compile Edit Options Files Setup
Quit | ||
Editor Line1 Col1 Indent Insert
Work.pro /* SAMPLE TEST
PROGRAM */ predicates
likes(symbol ,
symbol) clauses
likes(frank,sue).
likes(Harold,ruth). |
----Dialog----- Goal
:- | |
--------Message--------- |
--------Trace---------- | |
F1:Help F3:Search F4:Subst
F5:Copy F6:Move F7:del F8:ExtEdit F9:ExtCopy F10:End
Goal :
likes(Harold,ruth)<-! (return key press )
Turbo Prolog will reply to
you as
True
Goal : ( wait for next goal
)
Expressing
Facts
(English to (Turbo)T.
Prolog)
The right speaker is dead
(English)
Is(right_speaker,dead).
(T.prolog)
Fact
Relation
has_a(bill,
computer).
has_a
is_a(collie,dog).
is_a
likes(sue,chocolate).
Likes
Predicates
(examples)
employee(bill)
eligible(mary)
marital_status(joyce,married)
For example, you can
express the fact that mary is married and is eligible for employment
as
eligible(mary) and
marital-status(mary,married).
Facts expressed as prolog
clauses
English: Bill is an
employee.
Prolog:
employee(Bill).
English: Bob is married to
Mary.
Prolog:
married_to(Bob,Mary).
English:The speaker is
defective.
Prolog:
defective_speaker.
English: Tom is a
student.
Prolog:
student(Tom).
Relationship of clauses,
predicates, relations and objects.
Clauses
|
|__________________|
Facts
Rules
|________________|
Predicates Periods(.)
|____________|
Relations
Arguments
|
|_______________|
Objects Variables
A series of tutorial
articles that
will help you are as
follows:-
New tutorials are
added regularly.
Title |
Last updated |
| |
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-The
End-