Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword or section
Like this
3Activity
×

Table Of Contents

What Needs to be Installed for This Book?
Starting the Visual Prolog's Visual Development Environment
Creating the TestGoal Project for Running the Examples
Opening an Editor Window
Running and Testing a Program
Testing Language Tutorial Examples
Testing Examples in Test Goal
Testing Examples as Standalone Executables
Handling Errors
PROgramming in LOGic
Sentences: Facts and Rules
Facts: What Is Known
Rules: What You Can Infer from Given Facts
Queries
Putting Facts, Rules, and Queries Together
Variables: General Sentences
Overview
Exercises
From Natural Language to Prolog Programs
Clauses (Facts and Rules)
More About Facts
More About Rules
Predicates (Relations)
Variables (General Clauses)
How Variables Get Their Values
Anonymous Variables
Goals (Queries)
Compound Goals: Conjunctions and Disjunctions
Comments
What Is a Match?
Summary
Visual Prolog's Basic Program Sections
The Clauses Section
The Predicates Section
How to Declare User-Defined Predicates
The Domains Section
The Goal Section
A Closer Look at Declarations and Rules
Multiple Arity
Rule Syntax
Automatic Type Conversions
Other Program Sections
The Facts Section
The Constants Section
The Global Sections
The Compiler Directives
The include Directive
Matching Things Up: Unification
Backtracking
Visual Prolog's Relentless Search for Solutions
A Detailed Look at Backtracking
Backtracking in Standalone Executables
Controlling the Search for Solutions
Using the fail Predicate
Preventing Backtracking: The Cut
How to Use the Cut
The cut as a GoTo
Returning Computed Values
Simple Data Objects
Variables as Data Objects
Constants as Data Objects
Characters
Numbers
Atoms
Compound Data Objects and Functors
Unification of Compound Objects
Using the Equal Sign to Unify Compound Objects
Treating Several Items as One
An Example Using Compound Objects
Declaring Domains of Compound Objects
Writing Domain Declarations: a Summary
Multi-Level Compound Objects
Compound Mixed-Domain Declarations
Multiple-Type Arguments
Lists
Repetitive Processes
Backtracking Revisited
Pre- and Post-Actions
Implementing Backtracking with Loops
Recursive Procedures
What the Computer is Really Doing
Advantages of Recursion
Tail Recursion Optimization
Making Tail Recursion Work
How Not to Do Tail Recursion
Cuts to the Rescue
Using Arguments as Loop Variables
Recursive Data Structures
Trees as a Data Type
Traversing a Tree
Creating a Tree
Binary Search Trees
Tree-Based Sorting
What Is a List?
Declaring Lists
Heads and Tails
List Processing
Using Lists
Writing Lists
Counting List Elements
Tail Recursion Revisited
Another Example – Modifying the List
List Membership
Appending One List to Another: Declarative and Procedural Programming
Recursion from a Procedural Viewpoint
One Predicate Can Have Different Uses
Finding All the Solutions at Once
Compound Lists
Parsing by Difference Lists
Declaring the Fact Databases
Using the Fact Databases
Accessing the Fact Databases
Updating the Fact Databases
Adding Facts at Run Time
Removing Facts at Run Time
Keywords Determining Fact Properties
Examples
Arithmetic Expressions
Operations
Order of Evaluation
Functions and Predicates
Generating Random Numbers
random/1
random/2
randominit/1
Integer and Real Arithmetic
mod/2
div/2
abs/1
cos/1
sin/1
tan/1
arctan/1
exp/1
ln/1
log/1
sqrt/1
round/1
trunc/1
val/2
Exercise
Comparisons
Equality and the equal (=) Predicate
Comparing Characters, Strings, and Symbols
Strings
Symbols
The Flow Analysis
Compound Flow
Specifying Flow Patterns for Predicates
Controlling the Flow Analysis
Reference Variables
Declaring Domains as Reference
Reference Domains and the Trail Array
Using Reference Domains
Flow Patterns Revisited
Using Binary Trees with Reference Domains
Sorting with Reference Domains
Functions and Return Values
Determinism Monitoring in Visual Prolog
Visual Prologs Determinism Checking System
Predicates as Arguments
Predicate Values
Predicate Domains
Comparison with declaration of predicates
The Binary Domain
Implementation of binary terms
Text syntax of Binary Terms
Creating Binary Terms
makebinary/1
makebinary/2
composebinary/2
getbinarysize/1
Accessing Binary Terms
get*entry/2
set*entry/3
Unifying Binary Terms
Comparing Binary Terms
Example
Converting Terms to Binary Terms
term_bin/3
Modular Programming
Global Declarations
Global Predicates
Projects
Errors and Exception Handling
Exception Handling and Error Trapping
exit/0 and exit/1
errorexit/0 and errorexit/1
trap/3
errormsg/4
Error reporting
errorlevel
Handling Errors from the Term Reader
consulterror/3
readtermerror/2
Break Control (Textmode Only)
break/1
breakpressed/0
Rules for Efficient Programming
Determinism vs. Non-determinism: Setting the Cut
Classes and Objects
Encapsulation
Objects and Classes
Inheritance
Identity
Visual Prolog Classes
Class Declarations
Class Implementation
Class Instances - Objects
Destroying Objects
Class Domains
Derived Classes and Inheritance
Virtual Predicates
Static Facts and Predicates
Reference to the Object Itself (Predicate this)
Class Scopes
Classes as Modules
User-defined Constructors and Destructors
Abstract Classes
Protected Predicates, Domains, and Facts
Derived Class Access Control
Object Predicate Values
Object Predicate Domain Declarations
Formal Syntax for Classes
Writing and Reading
Writing
write/* and nl
openwrite/2
openappend/2
openmodify/2
filemode/2
closefile/1
readdevice/1
writedevice/1
Redirecting Standard I/O
Working with Files
filepos/3
eof/1
flush/1
existfile/1
existfile/2
searchfile/3
deletefile/1
renamefile/1
disk/1
copyfile/2
File Attributes
Opening and creating files
Special File Modes for DOS >= 4.0 and UNIX
openfile/5
File and Path Names
filenamepath/3
filenameext/3
Directory Searching
diropen/3
dirmatch/10
dirclose/1
dirfiles/11
Manipulating File Attributes
fileattrib/2
Handling terms in text files
Manipulating Facts Like Terms
String Processing
Basic String-Handling Predicates
frontchar/3
fronttoken/3
frontstr/4
concat/3
str_len/2
isname/1
format/*
subchar/3
substring/4
searchchar/3
searchstring/3
Type Conversion
char_int/2
str_char/2
str_int/2
str_real/2
upper_lower/2
term_str/3
External Databases in Visual Prolog
An Overview: What's in an External Database?
Naming Convention
External Database Selectors
Chains
External Database Domains
Database Reference Numbers
db_reuserefs/2
Manipulating Whole External Databases
A Complete Program Example
B+ Trees
Pages, Order, and Key Length
Duplicate Keys
Multiple Scans
The B+ Tree Standard Predicates
bt_create/5 and bt_create/6
bt_open/3
bt_close/2 and bt_delete/2
bt_copyselector
bt_statistics/8
key_insert/4 and key_delete/4
key_first/3, key_last/3, and key_search/4
key_next/3 and key_prev/3
key_current/4
Example: Accessing a Database via B+ Trees
External Database Programming
Scanning through a Database
Displaying the Contents of a Database
Implementing a Database That Won't Break Down
Updating the Database
Using Internal B+ Tree Pointers
Changing the Structure of a Database
Filesharing and the External Database
Filesharing Domains
Opening the Database in Share Mode
Transactions and Filesharing
Filesharing Predicates
db_open/4
db_begintransaction/2
db_endtransaction/1
db_updated/1
bt_updated/2
db_setretry/3
Programming with Filesharing
Implementing High-level Locking
A Complete Filesharing Example
Implementation Aspects of Visual Prolog Filesharing
Miscellaneous
Access to the Operating System
system/1
system/3
envsymbol/2
time/4 and date
comline/1
syspath/2
Timing Services
sleep/1
marktime/2
timeout/1
difftime
beep/0
osversion/1
diskspace/2
storage/3 and storage/11
storage/0
Bit-Level Operations
bitand/3
bitor/3
bitxor/3
bitleft/3
bitright/3
Access to the Hardware: Low-Level Support
bios/3 and bios/4
ptr_dword
membyte, memword, memdword
port_byte/2
Building a Small Expert System
Prototyping: A Simple Routing Problem
Adventures in a Dangerous Cave
Hardware Simulation
Towers of Hanoi
Dividing Words into Syllables
The N Queens Problem
Names
Keywords
Specially-Handled Predicates
Program Sections
Shortening Domain Declarations
Synonyms to Standard Domains
List Domains
Multi-alternative Compound Domains
Domains FILE and DB_SELECTOR
Specially Handled Predefined Domains
Declaring Reference Domains
Declaring Predicate Domains
Determinism Modes
Flow Patterns
Functions
Simple Constants
Terms
Variables
Compound Terms
Predefined Constants
Conditional Compilation
Including Files in Your Program
Modules and Global Programming Constructions
Compilation Units
Names with Global Scope
Include Structure of Multi-modular Programs
Include All Global Declarations in each Module
Where-used Strategy for Including Global Declarations
Qualification Rules for Public Class Members
Compiler Options for Multi-modular Projects
Compiler Directives
check_determ
code
config
project
Visual Prolog Memory Management
Memory Restrictions
Stack Size
GStack Size
Releasing Spare Memory Resources
Using DLL’s
Calling Other Languages from Visual Prolog
Declaring External Predicates
Calling Conventions and Parameter Passing
Input parameters
Output parameters
Return Values
Multiple declarations
Parameter pushing order
Leading underscored
32-bit Windows naming convention
Adjustment of stackpointer
Domain Implementation
Simple Domains
Complex Domains
Ordinary Compound Objects and Structures
Memory Considerations
Memory Alignment
Memory Allocation
Pre-allocation of Memory
The sizeof function
malloc and free
List Handling
Calling Prolog from Foreign Languages
Hello
Standard Predicates
Calling an Assembler Routine from Visual Prolog
Index
0 of .
Results for:
No results containing your search query
P. 1
Visual Prolog

Visual Prolog

Ratings: (0)|Views: 6,398|Likes:
Published by Ionut Şanta

More info:

Published by: Ionut Şanta on Oct 24, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See More
See less

05/24/2012

pdf

text

original

You're Reading a Free Preview
Pages 12 to 104 are not shown in this preview.
You're Reading a Free Preview
Pages 116 to 283 are not shown in this preview.
You're Reading a Free Preview
Pages 295 to 335 are not shown in this preview.
You're Reading a Free Preview
Pages 347 to 391 are not shown in this preview.
You're Reading a Free Preview
Pages 403 to 558 are not shown in this preview.

Activity (3)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Abdul Azis liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->