SECD Mania collection
This package consist from different models of SECD machines - result
of my experience with P. Henderson book "Functional Programming: Application
and Implementation", 1980, Prentice Hall.
I have a russian translation of this book since 1986. From march 2002
i started my second attempt to implement a sequence of modified SECD models.
This package is the result of these efforts.
All software in the package is licensed under GPL if it not conflicts
with some pattents or licenses owned by any people related with SECD architecture
such as Peter Henderson, Gordon Plotkin and Peter Landin.
Different machines inherits each other and are placed in different
The implamentation language for these machines is FreePascal.
More important machines in package are:
Full list of inheritance for the machines is listed in
- Henderson - the machine from the Henderson book.
- TR_SECD - Tail Recursion model. At this and later TailRecursion
implementations are used some ideas from John D. Ramsdell paper.
- LRC_GCL - Lazy Reference Count Garbage Collector for
SECD machine (it is partial collector of course)
- Fast_0, Fast_1 - Changes model of function call. No cons
used to create actual parameter list.
- Squeeze_1 - Encode SECD code and its integer parameters
into one 32-bit integer code.
- Cache_0 - Supply SECD machine with simple cache for S
- SEC_0 - Register D is removed from the machine without
loss of speed or functionality.
- CacheL2 (Base_0) - Level2 cache is implemented for SEC model.
- Lazy_0 - Commands and data structures are implemented
and tested in meta_machine and in SECD machine
for lazy evaluation purpouses.
- Lazy_1 - Compiler for lazy lisp programs is implemented.
- Lazy_2 - Trivial optimisations for lazy programs.
- TR_Lazy - TailRecursion mechanism for lazy evaluations
- MR_GC (Base_1) - Mark/Release Garbage Collector is added as
additional collector to the SEC machine.
- Files_0 - Some primitive I/O is implemented.
- Libs_0 - Static libraries.
- Shell_1 - Simple and usable shell is added.
- Pipes_0 - Multitasking and pipes are implemented. Non-deterministic
examples - queens, pitagorean numbers.
- TimeSh_0 - Timesharing is implemented. Changes in lazy
and pipe commands make them compatible with timesharing.
Later the bug is found and corrected into the next machine,
so don't use this machine !
- Files_1 - More advanced file handling is started. Some
changes, coused by bug in TimeSh_0 simpilfies the machine
and the compiler.
- Files_2 - Input/output is made asynchronous.
- Socket_0 - TCP connections are implemented and tested.
All aspects of TCP handling are made asynchronous (listen,
- RTL_0 - Implementation of Run Time Library (RTL). Changes
in shell, compilation and selfcompilation are implemented
as a shell functions. Client/server miniOS is implemented.
- Base_2 - pure_LISP documentation.
- Error_1 - Compiler error handling.
- Error_2 (Base_3) - Runtime error handling.
- Base_4 - MiniOS software and SECD architecture are
separated on two parts - kernel and user space.
Kernel is writen in strict_LISP and implements multitasking, I/O handling and
lazy evaluations events, passed to the kernel by the user tasks.
In user space programs follows the
Some comments for each machine improvements you may found in file MachineDIR/Changes.txt
All these files are concatenated in file History.txt.
Machines from the package may be used for educational purposes in areas
such as functional programing, computer design, system programming ....
Many of Henderson book exercises are solved by some of machines:
Exercise 6.3 is solved by SEC_0 machine.
Exercises 6.1, 6.2 and 6.4 are partialy solved in Fast_1.
Exercise 6.5 is solved in Base_0.
Exercise 6.6 is solved in TR_SECD, Fast_1 and SEC_0.
Exercise 8.7 is solved in Lasy_0.
Other possibility is to use some of these SECD machines as starting point
for some practical implementation of your own functional language.
The appropriate machine for this is CacheL2 (or Base_0) - it have the
The pascal sources for CacheL2 are compact and simple - about 20K,
including comments and meta_IO functions.
- full Tail Recursion handling
- Real time garbage collector (Reference Count)
- Minimal usage of meta_cons calls
- Command + parameters encoding into a 32-bit word.
- Internal cache
The next appropriate machine is Base_1. It inherits all properties
from Base_0. New properties:
Base_2 machine adds:
- SECD & lisp compiler mechanisms for lazy evaluation
- Mark/Release as additional garbage collector
Base_3 machine adds:
- static libraries and simple shell
- multitasking and interprocess communications
- timesharing and asynchronous file and TCP connection handling.
- run time library and miniOS.
- documentation for supported LISP dialect, called pure_LISP.
The last machine Base_4 adds:
- compiler error handling
- runtime error handling
- separation of the software in kernel/user space.
- interrupts for system event handling
- more flexible SECD architecture
- strict_LISP microkernel
Since Dec, 2002 i no new ideas in this field of investigations.
I done all these programs for fun, without any specific goal.
If you have comments, recomendations, improvements or someting else,
mail me at
(c) Skelet, Oct 2004 in terms of GNU GPL