Home
... .. .x+=:. .=*8888x <"?88h. z` ^% X> '8888H> '8888 u. u. u. . <k '88h. `8888 8888 ...ue888b x@88k u@88c. .u .@8Ned8" '8888 '8888 "88> 888R Y888r ^"8888""8888" ud8888. .@^%8888" `888 '8888.xH888x. 888R I888> 8888 888R :888'8888. x88: `)8b. X" :88*~ `*8888> 888R I888> 8888 888R d888 '88%" 8888N=*8888 ~" !"` "888> 888R I888> 8888 888R 8888.+" %8" R88 .H8888h. ?88 u8888cJ888 8888 888R 8888L @8Wou 9% :"^"88888h. '! "*888*P" "*88*" 8888" '8888c. .+ .888888P` ^ "88888hx.+" 'Y" "" 'Y" "88888% ` ^"F ^"**"" "YP' This is BONES, a compiler for R5RS Scheme that generates x86_64 assembly code. BONES is designed to be simple and easy to understand, both to reduce the effort to learn and extend the system and to keep the complexity of the compiler at a minimum. BONES is a batch-compiler, it takes a Scheme source file and produces an assembler file to be subsequently translated into object code. It is also a whole-program compiler, which means it does not support separate compilation of multiple modules. The runtime system is by default added to your program before it is compiled, so there are no external libraries, with the exception of a few bits from the C library ("libc") (this is optional). BONES is mostly R5RS-compliant, but intentionally cuts some corners to reduce code-size, increase performance and simplify the compiler and runtime system. Type-checks are generally omitted, for example. Very little error checking is done and arithmetic overflow of small integers ("fixnums") is not detected. Some R7RS procedures are available in addition to the primitives required for R5RS. Since BONES produces assembly-code, build-times are quite short. The produced code is CPU- and OS-specific and currently supports x86_64 on Linux, *BSD, Mac or Windows. Porting the system to other architectures and operating systems should be (relatively) straightforward, as the platform-specific parts of the compiler are small and the runtime-system is just a single file of about two thousand lines of assembly code. The compiler is self-compiling and uses just a few functions from the C-library. Alternatively, programs can be compiled on Linux without using a C library, by just invoking raw system calls, but support for this is currently incomplete (mostly related to number<->string conversion). Code compiled with BONES can be easily embedded into programs written in other languages as long as they allow calling C functions. There are very little debugging facilities. The compiler expects correct code and no attempt is made to provide more than the most basic error messages. It is recommended to develop and test code first in an interactive Scheme implementation and use BONES only for generating executables when the code can be assumed to work. The compiler itself is developed with a currently unreleased Scheme system, but as BONES compiles itself, no additional implementation is needed to make changes and extend the system. Distribution archive
The manual
gopher://schinkel.bevuta.com/1/bones/bones | gemini://schinkel.bevuta.com/bones/bones.gmi