SCHeme And Tiny (SCHANT)

Schant is a Scheme language compiler which conforms to most of the R4RS language specification. Schant is tail recursive and uses a stop and copy garbage collector.

Unsupported

=> in cond

Compare a number to a list of numbers

gcd lcm can only have two arguments

string-append can only have two arguments

number->string doesn't handle optional base argument

Only standard input output I/O procedures supported: eof-object? read display write newline read-char write-char

no load procedure

Real numbers can't start with "."

No force delay

No macros processing.

Extensions

(bitwise-and x y)

(bitwise-or x y)

(bitwise-not x)

(bitwise-xor x y)

(exit n)

(symbol-hash symbol)

Numbers

Three versions of schant exist. The first one: schant-int, only supports integer numbers. The second: schant-bigfloat8, supports integers and floating point numbers with a precision of 8 digits. Elementary functions (e.g. sin, exp, etc.) will have an accuracy of about 6 digits. Finally: schant-bigfloat12, supports integers and floating point numbers with a precision of 12 digits. Elementary functions (e.g. sin, exp, etc.) will have an accuracy of about 10 digits. Prior to the 24 06 release the math library functions are implicit when compiling scheme source code. After 24 06 the functions are explicit in the files math8.scm and math12.scm which represent 8 and 12 digit precisions.

Integer numbers can be specified as:
One or more decimal digits
A binary number of the form #bnn... with up to 32 binary n digits
A hexadecimal number of the form #xnn... with up to 8 hexadecimal n digits

Usage

Two steps are involved. First compile the scheme source to schant bytecodes. Then run the bytecodes with schant.

cat bin/schant-compiler.txt x.scm | bin/schant-int >bytecodes
cat args bytecodes | bin/schant-int

If floating point numbers are used then use schant-bigfloat8 or schant-bigfloat12.

cat bin/schant-compiler.txt x.scm | bin/schant-bigfloat8 >bytecodes
cat args bytecodes | bin/schant-bigfloat8

The file "args" is optional and can contain zero or more of the following arguments.

-d prints debug information while running. e.g. garbage collection invocations.

-z normally execution without this option treats symbols case insensitively. when the option is set treat symbols case sensitively.

A convenience script: compile-schant-with-shmall.sh is provided to compile schant from source using the shmall C compiler. It compiles in a stack / heap sized to 88MB (22000000 * 4). This constant can be adjusted up or down in the script.