-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
87 lines (64 loc) · 3.32 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
This is a Port of the https://github.com/fedesilva/styla to scala 2.13.3
Styla - a Prolog in Scala,
The name STYLA stands tentatively for "Scala Terms Yield Logic Agents" but hints
toward the fact that style (seen as "elegance" of implementation) has been a major
design principle behind it.
Styla is a fairly complete Prolog interpreter written in Scala, derived from
Kernel Prolog (see Fluents: A Refactoring of Prolog for Uniform Reflection
and Interoperation with External Objects CL'2000).
Just type "styla" to run the system from its precompiled
"styla.jar" file.
If you do not have Scala installed, and just want to embed Styla in
a Java or Android application, just download the self-contained
JavaCallsStyla.zip file, unzip it and type "go" inside the resulting folder,
then customize JavaMain.java as needed. the same directory contains also
the scripts "jstyla" and "jstyla.bat" that can run the interactive
Styla toplevel, even if you do not have Scala installed.
Use the scripts
"compile" to recompile the system with scalac
"run" to run it with scala and
"jrun" to run it with java (possibly edit for path info in this case).
The file "prolog/fluents/Lib.scala" embeds Prolog code that is present at
start-up. New Prolog code that you want part of the default libraries
can be added there.
Sample programs are in directory "progs".
Try "bm", "bm1", "bm2" shell scripts for benchmarking.
Among the features not found in most Prologs, first class Logic Engines -
and a generic view of everything as Fluents (TermSinks and TermSources)
that abstract away iteration over various data types, including answers
produced by Logic Engines.
Here are some limitations, most things not on this list
and expected from a Prolog system should work.
- toplevel goals that are not conjunctions should be parenthesized
- operators are all fixed and "xfx" associativity, but they match the
default priorities of most Prologs' operators - see examples in "progs"
- no gui or networking - Scala can do all that better
Take a look at "prolog.Main" for the start-up sequence - that gives
a glimpse of how to embed it into a Scala or Java program.
To add a new built-in, just clone the closest match
in prolog.builtins and drop it in the same directory - the
runtime system it will instantly recognize it.
Enjoy,
Paul Tarau
P.S. Styla uses a few interesting Scala goodies, not available in Java:
- higher order functions, maps, folds, case classes etc.
- combinator parsers - "poor man's DCGs" :-)
- Scala's elegant implicit conversions between
lists, arrays, sequences etc.
- Scala's arbitrary length integers and decimals (with
a natural syntax, in contrast to Java)
- Scala's """...""" strings - for regexps and to embed
Prolog code directly in Scala classes
- a few IO abstractions available in Scala that
view things like file operations as iterators -
a natural match to the original Fluents of
Kernel Prolog from which Styla was derived
- a few IO abstractions available in Scala that
view things like file operations as iterators -
a natural match to the original Fluents of the
Java-based Kernel Prolog from which Styla was derived
Note that he latest version of Kernel Prolog is now an
open source Google project at:
http://code.google.com/p/kernel-prolog/
-------------------------------------------
New: development of Scala and Akka Actors.