JSKI is a SK Machine as designed by David Turner in the 80's. This help is not a course about the theory of combinators invented by Haskell B. Curry and M. Schoenfinkel at the beginning of the 1900's. A course can be found at:
http://www.infres.enst.fr/~bellot/CELSK/index.html
It will be refrered as "the course".
JSKI.jar
is an executable jar. It can be executed by double clicking on it. Manually, the ideal command is:
java -server -Xms1024M -Xmx1024M -Xss128M -da -dsa -XX:-UseGCOverheadLimit -jar JSKI.jar
Try to use these options!
In JSKI, only S
, K
and I
are primitive combinators.
All other combinators are defined symbols. JSKI maintains a table of symbols and each symbol possibly has a functional
definition. When a symbol is applied, it is replaced by its definition. The set of these definitions is called
the workspace.
The content of the workspace can be erased with
the menu Workspace, menu item Empty workspace.
The current state of the workspace can be saved in a text file by using
the menu Workspace, menu item Save workspace.
The current workspace memory occupation can be seen by using
the menu Workspace, menu item Nodes count.
The classical definitions of some well-known combinators, as defined in the course, can be loaded into the workspace by using the Load predefineds buttons. The name of the defined combinators are listed at the top of the JSKI window.
The text area in the program zone is where programs are edited. It is subject to the usual Open, Save and Save as... file menu. Don't forget to make a regular save in case something goes wrong. The current state is displayed just above the text area. The program text area must contain symbol definitions. A definition is an expression:
#DEF <symbol> = <term> ;;
where <symbol>
is any symbol beginning with a letter, made of letters and digits
and different from S
, K
and I
).
When the program text area is compiled using the Compile buffer
button, the definitions are registered in the current workspace. It is also possible
to select a region in this buffer and use the Compile selection
button.
To erase a definition in the current workspace, use:
#UNDEF <symbol> ;;
In any term, especially in definitions, you can use one of the four abstraction algorithms of the course using the notations:
(\+ <symbol> . <term>) (\++ <symbol> . <term>) (\+++ <symbol> . <term>) (\++++ <symbol> . <term>)
The parentheses around are mandatory. The values of these expression replace the expressions at the time the system reads them. Don't forget to load predefineds symbols if you use the three last abstraction algorithms.
In a definition, you can use the functional value reference of a symbol f
.
It is noted @f
. When the definition are reads, it is left as is. Then
after the definition are reads, it is replaced by the functional value of the
symbol f
if there is one, or by f
if there is not.
For instance:
#DEF factorial = (\+ N . (=0 N) 1 (* N (@factorial (1- N)))) ;;
This allows to create circular graphs for implementing recursion as mentionned in D. Turner fundation article.
You can enter term to evaluate in the Expression text area. Then you can do the Head reduction button or the Full reduction button. Hiting the enter key runs a head reduction. Computations may be interrupted using the Interrupt button. The results are displayed in the Result text area. A single head reduction can be obtain with the appropriate button. The Expression text area has an history mechanism accessible with the Up and Down arraows.
Under the Result text area, the three buttons Head reduction, Full reduction allow to finish the reduction of the term in the text area. The button Next head redex allows to do a single hed reduction of the term in the text area.
The button Interpret allows, sometimes, to make the result more humanly readable by searching the results for integers, for lists, for booleans, etc.
In the Expression text entry field, you can entrer # <symbol>
,
the result will be the functional value (the definition) of the symbol
if any. In fact #
is a combinator returning the functional value
of its argument if there is one, returning its argument otherwise.
In the terms, natural numbers can be written in base 10. At the reading, they
are translated into Church's integers.
Lists can be written using the bracket notation
[a,b,c]
or [a,b,c . d]
Enjoy ! Suggestions and bugs can be send to
bellot@telecom-paristech.fr
.