# 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)`

## 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.

## 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.

-h prints a histogram of schant vm opcode counts at the end of execution.

-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.