pure_LISP tutorial

SECD: [ index ] [ collection ] [ hard_SECK reference ]
LISP: [ reference ] [ tutorial ] [ implementation scheme ]


This document describes the installation and introduction to the package SECD_Mania, especially the final part of the package - pure_LISP language and its implementation base - the virtual SECD machine.


1. Introduction.

pure_LISP is a pure LISP implementation for GNU/Linux OS, based on an modified version of SECD virtual machine.

"Pure" means, that the language is functional as possible:

The language have the following properties:

The properties, omited in the language:

2. Installation.

Download the pure_LISP from here.

Old mirrors:

skelet.ludost.net

skelet.hit.bg/SECD

Requirements: You must have FreePascal installed on your system.

If you use Debian Linux, simply type:

apt-get install fp-compiler binutils

If you use some other Linux, go to FreePascal home page for instructions.

Note:

There is some troubles with the new versions of Free Pascal (Version 1.9.x and higher). One of the meta files (sec_drivers.pp) uses the Linux unit. This unit must be replaced with the new units Unix and BaseUnix in future versions, but now (October 2004) i use the unit OldLinux instead of Linux to resolve current dependencies. This change is made only in sub-package Base_4.

Usage:

Download the package in some new directory (i prefer 'secd'), then type:

tar xzf LISP_0.8.tar.gz

Now you have the package sources in subdirectory Base_4.

Type:

cd Base_4
./make_all

After this, SECD virtual machine will be compiled and started. (read the make_all shell script for details).
The bootstrap process is simple - first the strict_LISP program kernel.sec is loaded and started.
Kernel, together with SECD machine emulates multitasking system.
The first task loaded and executed is the SECD code from the file miniOS.sec. This code defines a small miniOS program.

The following lines appear on the console:

Loading /home/YourAccount/secd/Base_4/kernel.sec ...
Executing kernel ...
Loading miniOS ........ Done
SEC>
Now type at the prompt:
(add 2 5)
miniOS will respond to you:
SEC>(add 2 5)
(#ldc 2 #ldc 5 #add)

7
SEC>
The first line of the response - list (#ldc 2 #ldc 5 #add) is a SECD code, compiled version of your command (add 2 5). This code is then executed and the result - integer number 7 in this examle is printed on the conslole.

Try a more complex expression:

SEC>(let (mul a a) (a add 2 3))
(#delay
(#ldc 2 #ldc 3 #add)
#trlet_1 #ld_0_0 #rec #ld_0_0 #trrec_mul)

25
SEC>
The above expression is a pure_LISP record for the mathematical notation:
Let a is the sum of 2 and 3.
Evaluate a multiplied by a and give the result.

More info about possible pure_LISP functions you may find in pure_LISP reference.


3. Files in the package.

Open a new console and go to the pure_LISP package subdirectory (in my computer this is /home/skelet/secd/Base_4).

Type:

ls -l
Computer will show you the package files and subdirectories.

These files may be arranged in some different groups:


4. pure_LISP examples.

For the most of the examples the following procedure must be used to start them correctly:

Examples in subdirectory Numbers demonstrate the usage of infinite sequences in lazy evaluations. They all uses the library numbers.lib. In this library are defined lists of all numbers, prime numbers and pitagorean triples. But in final expression only limited part of these lists may be evaluated and printed (if we try to print all numbers, some overflow will happens).

Numbers content:

Examples content:

More about problems with non-deterministic examples and their miniOS variants you may read in file ../History.txt.


(c) Skelet, Nov 2002 in terms of GNU GPL

Mail me at home or work