Index of /geminiatari/FILES/LANGUAGE/PROLOG68

      Name                    Last modified       Size  Description

[DIR] Parent Directory 24-Sep-2006 15:35 - [TXT] BUILTINS.WAM 23-Oct-1993 03:43 6k [TXT] DEBUGGER.WAM 23-Oct-1993 03:43 20k [TXT] DRIVER.WAM 23-Oct-1993 03:43 10k [TXT] DSTRUCT.WAM 23-Oct-1993 03:43 5k [TXT] ENCODER.WAM 23-Oct-1993 03:43 17k [TXT] INDEXER.WAM 23-Oct-1993 03:43 7k [TXT] INIT.WAM 23-Oct-1993 03:43 7k [TXT] LIBRARY.WAM 23-Oct-1993 03:43 37k [TXT] LIESMICH 23-Oct-1993 03:43 21k [TXT] PROLOG.LST 23-Oct-1993 03:43 1k [   ] PROLOG68.DVI 23-Oct-1993 03:43 226k [TXT] QUEENS.PL 23-Oct-1993 03:43 1k [TXT] RANDOM.PL 23-Oct-1993 03:43 1k [TXT] SHELL.WAM 23-Oct-1993 03:43 5k [TXT] TMPALLOC.WAM 23-Oct-1993 03:43 16k [TXT] WAM.TOS 23-Oct-1993 03:43 87k [TXT] WORM.PL 23-Oct-1993 03:43 5k [TXT] XLATOR.WAM 23-Oct-1993 03:43 37k

-------------------------------------------------------------------------------


	   /˙˙˙˙˙)		  /˙)			    /˙˙˙˙˙) /˙˙˙˙˙)
	  / /˙) /		 / /			   / ____/ / /˙) /
	 / (_/ /		/ /			  / /	  / (_/ /
	/ ____/ /˙˙˙˙) /˙˙˙˙˙) / / /˙˙˙˙˙) /˙˙˙˙˙) /˙˙˙) /  ˙˙˙) /     /
       / /     / /˙˙˙ / /˙) / / / / /˙) / / /˙) / (___/ / /˙) / / /˙) /
      / /     / /    / (_/ / / / / (_/ / / (_/ /       / (_/ / / (_/ /
     (_/     (_/    (_____/ (_/ (_____/ (___  /       (_____/ (_____/
					   / /
				      /˙˙˙˙ /
				     (_____/

			     (pre-release version)



		 ˝ Copyright 1989,1990,1991,1992 Jens Kilian
			     All rights reserved


-------	Shipping list ---------------------------------------------------------

	DEMO			Demonstrations
	    QUEENS.PL
	    RANDOM.PL
	    WORM.PL

	CODES			Pre-compiled versions of the compiler
	    BUILTINS.WAM	and run-time system
	    DEBUGGER.WAM
	    DRIVER.WAM
	    DSTRUCT.WAM
	    ENCODER.WAM
	    INDEXER.WAM
	    LIBRARY.WAM
	    SHELL.WAM
	    TMPALLOC.WAM
	    XLATOR.WAM

	DOC
	    LIESMICH		This document (German version)
	    README		This document (English version)
	    PROLOG68.DVI	Preliminary documentation (in German)

	INIT.WAM		Bootstrap information
	PROLOG.LST

	WAM.TOS 		Main program (emulator, primitive operations)

-------	Overview --------------------------------------------------------------

  This floppy contains pre-release version 0.9.126 of Prolog-68, a new Prolog
system for Atari's ST series. When the program is finished, it will be made
publicly available as free software (NOT public domain software !) together
with the source code.

  The present version may be freely distributed, but NOT modified or used
commercially. 'Commercial use' includes distribution, if a fee is charged
and if the rate for a single disk exceeds the sum of the disk's price and
the postal (or other carrier's) charge by more than DM 2,- (at a reasonable
rate of exchange, if applicable).

Again:	This is a pre-release version, meaning that I don't even guarantee
	the correctness of this document !

  Prolog-68 is based on the `Warren Abstract Machine'; it contains a compiler
(written in Prolog) which translates program clauses into intermediate code.
This intermediate code is stored (as direct threaded code) and executed by a
simulator. The system attains a speed of 12 kLIPS on the 'nrev' Benchmark,
which is quite acceptable on an Atari ST. The program was tested on an Atari ST
with 4MB of main storage, but should be able to run on all STs with 68000 (!)
processors. As usual, `more is better' regarding main memory; at least 250 KB
are required just to load the system. The files in the 'CODES' folder contain
a pre-translated version of the compiler and user interface. DON'T MODIFY
THESE FILES UNDER ANY CIRCUMSTANCES !

  Neither the compiler nor the run-time environment are finished, so users will
have to do without database operations ('assert', 'retract') and some
other features. Also, predicate names of the compiler are publicly visible
(to programs at least), so you can produce wonderful crashes just by using
'consult'.

-------	Known bugs ------------------------------------------------------------

  The present version 0.9.126 contains the following bugs (to be fixed in
later versions):

	* erase/1 doesn't free the memory of the terms it erases

-------	Predefined predicates -------------------------------------------------

  I'm trying to create a complete Prolog system which is compatible to standard
dialects like Prolog-10 and Quintus Prolog. Most predefined predicates have
already been implemented, but here they can only be described in short:

    - Control:

	','/2
	';'/2
	'!'/2			(see below)
	'->'/2			(see below)
	call/1
	'\+'/1			(as 'not'/1 in TOY Prolog)
	true/0
	otherwise/0		(= true/0)
	fail/0
	false/0 		(= fail/0)
	repeat/0
	if_exception/3		(error handling, see below)
	signal_exception/1
	signal_error/3
	propagate_error/4
	trap/2
	set_error_handler/3
	once/1			(as in TOY Prolog)

	  if_exception/3 and signal_exception/1 are similar to tag/1 and
	tagexit/1 in TOY Prolog. Using

	    if_exception(?ErrorTerm, +Goal, +Recovery)

	one can call 'Goal'. If during the execution of 'Goal' there occurs
	a call to

	    signal_exception(?Term),

	'Term' is unified with 'ErrorTerm', 'Recovery' is called and the
	original call to if_exception/3 is exited. All variable bindings made
	in 'Goal' are undone.

	  The predicates

	    signal_error(+Type, +Arg, +Goal)
	    propagate_error(+Type, +Arg, +Goal, +Context)
	    trap(+Goal, +Handler)
	    set_error_handler(+Type, -OldHandler, +NewHandler)

	are used for handling errors. The details may yet change, therefore
	these predicates shouldn't be used at the moment.
	
	  The 'cut' works inside metacalls, but its scope is limited. In
	'call(X)', a 'cut' inside 'X' will have effect only inside the
	parentheses. A rule of thumb: `letters block the cut'.

	  '->'/2 resembles a 'cut' which is restricted to part of a clause.
	The call  (P -> Q; R)  can be used as an IF/THEN/ELSE statement:
	If P can be satisfied, Q is called, otherwise R is called.
	(P -> Q) on its own is identical to (P -> Q; fail).

    - Input/Output:

	  This part of the program is almost complete.

	read/1		    Input and output of terms
	write/1
	writeq/1
	display/1	    (Always outputs to 'user' !)
	write_canonical/1   (Output in prefix form, also called displayq/1)
	print/1 	    (Output via portray/1, if defined by the user)
	portray_clause/1    (Prints clauses in easy-to-read format)

	get0/1		    Input and output of characters (using ASCII values)
	get/1
	skip/1		    *
	put/1		    *
	nl/0
	tab/1		    * These predicates can take a parameter that is a
			      full arithmetical expression (not just an
			      integer).

	is_endfile/1	    Specifies end-of-file character
	is_newline/1	    Specifies end-of-line character
	is_newpage/1	    Specifies end-of-page character
	is_endline/1	    Detects end-of-line (must be called with its
			    argument fully instantiated !)

	open/3		    Management of input/output streams (see below)
	open_null_stream/1
	close/1
	current_stream/3
	nofileerrors/0
	fileerrors/0
	flush_output/1
	set_input/1
	set_output/1
	current_input/1
	current_output/1
	absolute_file_name/2

	read/2		    Input/Output of terms to arbitrary streams
	write/2
	writeq/2
	display/2
	write_canonical/2   (a.k.a. displayq/2)
	print/2

	get0/2		    Input/Output of characters to arbitrary streams
	get/2
	skip/2		    *
	put/2		    *
	nl/1
	tab/2		    * (see above)

	character_count/2   Inquiry about streams' status
	line_count/2
	line_position/2
	stream_position/3   Inquire and set read/write position
	stream_position/2   Inquire positions of all open files

	see/1		    Prolog-10 compatible file handling
	seeing/1
	seen/0
	tell/1
	telling/1
	told/0

	ttyget0/1	    Prolog-10 compatible input/output of characters
	ttyget/1	    to the 'user' stream.
	ttyskip/1
	ttyput/1
	ttynl/0
	ttytab/1

	biosget0/1	    (used in demonstrations only; will disappear
	biosput/1	     some of these days ...)
	biosstat/0

	op/3		    (Define or delete operators)
	current_op/3	    (Inquire current operators)

	sread/2 	    (Read a term with its symbol table)
	sread/3 	    (The same, using an arbitrary input stream)

	  The stream predicates come from Quintus Prolog. An (input or output)
	stream is a special object that can be created with

	    open(+FileName, +Mode, -Stream).

	`FileName' is the name of a file, `Mode' must be one of the atoms
	'read', 'write', 'append', 'read_binary', 'write_binary' or
	'append_binary'. The stream returned by open/3 can be used with e.g.

	    write(+Stream, ?Term)
	
	and closed with

	    close(+Stream).

	  Besides file streams there are certain predefined streams, accessible
	through the following names:

	    user	    (Quintus compatible)
	    user_input
	    user_output
	    user_error

	    printer_output  (Extensions for accessing the ST's devices)
	    modem_input
	    modem_output
	    midi_input
	    midi_output
	    ikbd_output

	  Use e.g.   write(printer_output, T)  to output T to the printer port.

	  As of the present version, the 'read' predicates are fully compatible
	to Edinburgh Prolog (in particular, C-Prolog and Quintus Prolog).

    - Arithmetic

	'is'/2		    Evaluate expressions

	'=:='/2 	    Compare expressions
	'=\='/2
	'<'/2
	'=<'/2
	'>'/2
	'>='/2

    - Term classification:

	var/1		    (Standard)
	nonvar/1
	atom/1
	integer/1
	atomic/1

	nonatomic/1	    (Negation of atomic/1)
	constant/1	    (NOT identical to atomic/1)
	nonconstant/1
	composite/1	    (Checks if a term is composite)
	simple/1	    (Negation of composite/1)
	callable/1	    Checks if a term can be called (nonvarint/1 in TOY)

    - Structure access:

	functor/3
	arg/3
	'=..'/2

	name/2		    Conversion between constants and strings
	atom_chars/2
	number_chars/2

	numbervars/3	    Enumerate variables in a term (e.g. for write/1)

    - Comparison of arbitrary terms:

	'=='/2
	'\=='/2
	'@<'/2
	'@=<'/2
	'@>'/2
	'@>='/2
	compare/3
	sort/2
	msort/2
	keysort/2

	  When comparing terms with '@<', ..., '@>=', the following total
	ordering relation over the set of all terms is used:

	a) Variables @< Numbers @< Atoms @< Composite Terms

	b) Variable1 @< Variable2   is uniquely defined, but has no further
				    meaning to the user (... in the Prolog-10
				    library, this feature is used for some
				    REALLY dirty tricks)

	c) Number1 @< Number2	    iff Number1 < Number2

	d) Atom1 @< Atom2	    iff Atom1's name is lexicographically less
				    than Atom2's name (as in TOY Prolog)

	e) Term1 @< Term2	    iff  i) Term1's arity is less than Term2's
					    arity

					ii) both arities are equal and
					    functor(Term1) @< functor(Term2)

				       iii) both arities and both functors are
					    equal and there exists an i
					    such that for all j, 1 ó j < i:

				       argument(Term1, j) == argument(Term2, j)

					     and

				       argument(Term1, i) @< argument(Term2, i)

	compare/3 acts as if it were defined as

	    compare('<', X, Y) :- X @< Y.
	    compare('=', X, Y) :- X == Y.
	    compare('>', X, Y) :- X @> Y.

	  sort/2, msort/2 and keysort/2 sort lists according to the ordering
	relation explained above. sort/2 discards duplicate elements, msort/2
	doesn't; keysort/2 expects a list of terms having the form

	    Key - Value

	It ignores the 'Values' and uses the 'Keys' to sort the list. keysort/2
	keeps duplicate elements and preserves their original ordering; for
	example,

	    | ?- keysort([4-a, 1-b, 5-c, 1-d, 4-e, 0-f], Sorted).
	    Sorted = [0-f, 1-b, 1-d, 4-a, 4-e, 5-c]

	These predicates are at best linear, in the worst case they are
	O(NlogN) (so we can safely conclude that they DON'T use 'quicksort').

    - Program status:

	listing/0	    List all predicates
	listing/1	    List some predicates

	current_atom/1	    (Inquire known atoms etc.)
	current_predicate/2

	halt/0		    (Halt the program)
	halt/1		    (ditto, specifying the exit code)
	break		    (Start a new run level)
	abort		    (Abort and return to Prolog top level)

    - Debugger:

	  Yup, at last there's a debugger, even if it works a bit different
	from the usual kind (sigh).

	trace/1		    (start debugging)
	debug/1

	nodebug/0	    (see below)
	trace/0
	debug/0

	spy/1		    (set & delete spy (=break) points)
	nospy/1
	nospyall/0
	leash/1		    (tells the debugger where to stop)
	harness/1	    (as leash/1, but controls spy points)
	debugging/1
	unknown/2	    (trap calls to undefined predicates)

	  The debugger can be started via  trace(+Goal)  in single-step
	(creep) mode, or via  debug(+Goal)  in run (leap) mode. It will
	start executing 'Goal'; trace/0, debug/0 and nodebug/0 only work
	if the debugger is active. The debugger is NOT started automatically
	when an error occurs.

	  unknown(-OldAction, +NewAction) is an abbreviation for
	prolog_flag(unknown, -OldAction, +NewAction) (which see).

	  For more detailed informations concerning debugging, consult any
	decent Prolog textbook.

    - Database operations:

	There are no database operations in this version ! (but see below)

    - Database references:

	  Database references allow fast access to stored clauses, terms etc.
	Though there are no database operations as yet, the internal database
	has already been implemented, including one predicate belonging here:

	erase/1 	    (Erases a database reference)

    - Internal database:

	  The internal database exists for reasons of efficiency. It can only
	be used for storing terms, not for storing clauses.
	  This part of the program is largely complete.

	recorda/3
	recordz/3
	recorded/3
	current_key/2

	  Using  recorda(+Key, +Term, -Ref)  resp.  recordz(+Key, +Term, -Ref),
	the `Term' is stored in the internal database under `Key'. A database
	reference to the stored term is returned in `Ref'; it can be used to
	remove the term via erase/1.  recorded(+Key, ?Term, ?Ref)  retrieves a
	stored term,  current_key(?KeyName, ?KeyTerm)  inquires all known keys.

    - Set operations:

	  setof/3 and bagof/3 have not been implemented yet. There is a
	restricted version of bagof/3 identical to TOY Prolog's bagof/3
	(but not compatible to the standard version).

	findall/3	    Substitute for bagof/3

	  The difference between standard bagof/3 and TOY Prolog's idea of this
	is the treatment of free variables in the goal passed as parameter. The
	standard version collects all solutions that yield the same values for
	these variables, while findall/3 (and bagof/3 in TOY Prolog) regard all
	of them as existentially quantified.

    - Grammar rules:

	expand_term/2	    Called before a clause is compiled; does
			    transformation of grammar rules. The user can
			    define the predicate term_expansion/2 to make
			    additional transformations.

	phrase/3	    Application of a grammar rule
	phrase/2

	  Instead of a single non-terminal symbol (as in TOY Prolog),
	phrase/[2,3] can handle an entire phrase (right-hand side of a grammar
	rule). phrase/2 is defined as

	    phrase(Phrase, List) :- phrase(Phrase, List, []).

    - Miscellaneous:

	'='/2		    (Unification)
	length/2	    (Length of a list)
	member/2	    (Element relation for a list)
	memberchk/2	    (ditto, deterministic)
	append/3	    (List concatenation)

    - Special predicates (Quintus compatibility):

	prolog_flag/3	    (modify global flags)
	prolog_flag/2	    (inquire global flags)
	prompt/2	    (inquire and set console input prompt)
	statistics/0	    (print statistics)
	statistics/2	    (inquire statistics)

	  prolog_flag/2 and prolog_flag/3 access some global flags which are
	used to control several internal feratures. Contrary to other Prolog
	systems, the value of a flag is always an integer. The currently
	existing flags are:

	Name		       Values (Default)	Purpose

	character_escapes	0, 1	(0)	Controls evaluation of escape
						sequences on input and output
	fileerrors		0, 1	(1)	Controls error handling when
						accessing nonexistent files
	gc_trace		0, 1, 2	(0)	Controls amount of tracing
						information printed when the
						garbage collector is run
						(0=none, 1=terse, 2=verbose)
	unknown			0, 1	(1)	Controls handling of undefined
						predicates (0=just fail,
						1=signal an error)
	error_handling		0, 1, 2	(2)	Controls error handling
						(0=failure, 1=activation of
						error handling routine,
						2=additional error messages)

	prolog_flag(+Flag, -OldValue, +NewValue) can be used to change the
	value of the `Flag', prolog_flag(?Flag, ?Value) inquires such a value
	without changing it.

	  The first parameter to statistics/2 must be one of the following
	keywords:

	'runtime'	    asks for the running time

	'memory'	    enquire the sizes of various memory areas
	'core'		    (some are duplicates, e.g., heap = program)
	'program'
	'heap'
	'global_stack'
	'local_stack'
	'trail'

	'garbage_collection' garbage collection statistics (what else ?)

	The second parameter is unified with a list of integers indicating the
	results of the enquiry.

    - System dependent predicates:

	garbage_collect/0   Forces garbage collection. Not needed in normal
			    programs, present for compatibility reasons.

	system/1	    Pass an atom to a shell (works e.g. with Gul„m)

	  The name of this predicate will change in one of the next releases
	for compatibility reasons.


  I know that this list is no sufficient documentation, but unfortunately I
can't supply more at this time. At least I'm working on a manual written with
LaTeX (anybody who doesn't have TeX should start looking, if only for an
opportunity to print DVI files. The nearest university would be a good place
to start. If they don't run TeX, they don't have a computer). I've packaged
a preliminary version with this release.
  Whenever it comes out, the documentation will be in GERMAN. Sorry again.

-------	Demonstrations --------------------------------------------------------

The 'DEMO' folder contains two example programs: a version of the n-Queens
problem ('QUEENS.PL') and a little game ('WORM.PL', 'RANDOM.PL').

Use e.g. the following to read & start the programs:

		| ?- ['demo\queens'].
		| ?- queens(N). 	solve the 'N queens' problem (N >= 4)
    or		| ?- test.		solve the '5 queens' problem


		| ?- ['demo\worm', 'demo\random'].
		| ?- worm.	(use keys 2, 4, 6, 8 on the
				 numeric keypad)

-------	Miscellany ------------------------------------------------------------

    ... My address has changed:

		 Jens Kilian
		 Holunderstraže 19
	D-W-7033 Herrenberg-Gltstein
		 Germany

    ... e-mail to:

	Internet:	jensk@hpbbrn.bbn.hp.com
	MausNet:	Jens Kilian @ BB

    ... There are unreasonable people out there, so I must specifically
	disclaim any warranty even for this pre-release version:

				  NO WARRANTY

- BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

-------------------------------------------------------------------------------

	Have fun,

		Jens Kilian