Scheme language Eked Quickly With INTegers (SEQWINT Project)

The Seqwint project is a collection of compilers and interpreters used to generate a scheme compiler called schant. The project is a "scheme from scratch". The process builds schant to a native target starting from a tiny virtual machine compiled down to assembly language. x86, arm and riscv targets are supported running on either 32 bit or 64 bit processors. The implementation uses data types no more complex than 32 bit signed integers and 32 bit integer arrays.

The process begins with the simpvir virtual machine interpreter. From that we derive a C subset compiler called shmall and a Scheme program called Schimper (SCHeme IMPERative). Finally a mostly R4RS compliant scheme compiler (implemented as a virtual machine written in C) called schant is derived.

A build of seqwint requires a *nix environment but does not require the use of a preexisting C compiler although any seqwint C source code can be compiled with any existing K&R compliant C compiler e.g. like gcc or tcc. Tools required for the build are nasm (x86) or 'as' (arm and riscv), ld and sh/bash with its standard commands. When building for Windows using Cygwin, in place of ld, gcc is required. When building for FreeBSD, in place of ld, cc is required. In both of these cases system calls make direct use of calls to the C library functions getchar, putchar and exit. In all other cases system calls are made without reference to any libraries.

The simpvir virtual machine is implemented in C. The target assembly language translation (pre-assembled) is provided as the starting point of the build process. Because of its simplicity simpvir could easily be implemented in any host language. All aspects of the build process could be based on the sole existence of simpvir if desired.

Author

Rick Miskowski. I am at: 55portal55 "AT" gmail "DOT" com

My twitter handle is @fossadvocate

Usage

To build the binaries in the bin directory and run validation tests run ./build.sh. For simple "hello world" examples with comments on how to use the compilation tools inspect and run ./quick-start.sh. Executables produced in the bin directory are: simpvir, shmall, shmall-vm.txt, schant-compiler.txt, schant-int, schant-bigfloat8 and schant-bigfloat12.

An optionally runable ray tracer application can be built and run which gives the floating point version of schant in schant-bigfloat8 a workout. It can be executed in the test-renderer directory. Run build-and-run-renderer.sh. More information about this project and it's web manifestation can be found at JSRender3D

Tested OS / Machine

                                    r
                    x       a   a   i
                    8   a   r   r   s
            i   i   6   m   m   m   c
            5   6   _   d   v   v   v
            8   8   6   6   6   7   6
            6   6   4   4   l   l   4

Cygwin      .   .   Y   .   --  --  --
FreeBSD     .   .   .   Y   .   .   .
OpenBSD     Y   Y   .   .   .   .   .
Darwin      .   Y   Y   .   --  --  --
GNU/Linux   Y   Y   Y   .   Y   Y   Y

License

All of the software for the Seqwint Project is governed by the GPLv3 License

Bibliography

Peter Henderson. Functional Programming Application and Implementation. 1980

Kernighan, Ritchie. The C Programming Language 1988

Clinger, Rees et al. Revised(4) Report on the Algorithmic Language Scheme 1991

Peter Norvig. Paradigms of Artificial Intellegence Programming 1991

Abelson, Sussman. Structure and Interpretation of Computer Programs 1996

Shirley, Morley. Realistic Ray Tracing. 2003

www.wikipedia.org topics:
Binary trees
Hash table
Open addressing
Lexical analysis
String interning
Recursive descent parser
Shunting yard algorithm
Tracing garbage collection
Virtual machine
Ray tracing:
Axis-aligned minimum bounding box
Octree