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, riscv and 680x0 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. As an addendum a standalone peephole optimizer can be applied to the assembly output of Schimper to squeeze out faster execution times. The program is peep.c.
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 the 'as' assembler, ld and sh/bash with its standard commands. For some OS / target combinations, in place of ld, gcc is required in which case system calls make direct use of calls to the C library functions getchar, putchar, fflush and exit. In all other cases direct kernel 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.
Rick Miskowski. I am at: 55portal55 "AT" gmail "DOT" com
My twitter handle is @fossadvocate
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, schant-int, schant-bigfloat8 and schant-bigfloat12. Existing executables in the bin directory are recreated to prove the build process is self reproducing. These executables are: schant-compiler.txt, schant-int.vm.txt, schimper.txt, shmall.txt and simpvir-assembler.txt.
A couple of optionally applications can be built and run.
First, a 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
Second. a tester of the double floating point intrinsics can be built and run. It is a double float reader (strtod) and double writer (write_float). The output from write_float is limited to 9 digits of precision. This test starts with a program which generates some textual double float numbers which are fed to read-print-double.c. To run the test execute test-intrinsics.sh
a r
x a a a i
8 a r r r s 6
i i 6 m m m c c 8
5 6 _ d v v h v 0
8 8 6 6 6 7 6 6 x
6 6 4 4 l l 4 4 0
Cygwin . Y . . - - - - -
FreeBSD Y Y . Y . . . . .
OpenBSD Y Y . Y . . . . .
NetBSD . . . . Y . . . .
Darwin . Y Y . - - - - -
GNU/Linux Y Y Y Y Y Y Y Y -
Bare Metal . . . . . . . Y Y
All of the software for the Seqwint Project is governed by the GPLv3 License
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
Peephole optimization
Ray tracing:
Axis-aligned minimum bounding box
Octree