CHICKEN (Scheme implementation)

Chicken is a compiler and interpreter for the Scheme programming language that translates Scheme source code to C. Chicken is mostly R5RS compliant and offers many enhancements to this standard. This is free software, distributed under a BSD license. The author Felix Winkelmann.

Design

How many Scheme compiler uses the C programming language as well as Chicken intermediate code. Scheme programs are translated by the Chicken compiler to C, and then by a standard C compiler translated into the machine language of the target system, which can then be executed. The wide distribution of C compilers makes maximum platform independence.

The design of Chicken was inspired by a paper by Henry G. Baker in 1994, in an innovative way for translating Scheme to C has been described. Here, a Scheme program is translated into C functions, however, do not return to the caller, but instead call a so-called continuation after termination. These continuations are other C functions that are generated by the compiler and Chicken are passed as parameters to other C functions.

This is nothing more than the continuation- passing style, formulated in C. Baker's novel idea is to use the C stack as Scheme heap. Therefore, normal stack operation as automatic variables generation, alloca calls for the generation of arrays of variable size and the like. Once the stack is full, garbage collection is started to empty the stack again. In Chicken design a Copying Garbage Collector is used, which was first described in 1970 by CJ Cheney. Here, all Scheme objects and continuations nor will moved to the heap, but no C- stack frames will be shifted, thus Chicken without knowledge of the underlying C implementation manages.

This approach gives many operations, the speed of normal stack operations, in particular invoking the continuations is a simple function call. Further as required by this scheme tail recursive behavior can be achieved without the memory requirement increases asymptotically.

Limitations and deviations from the standard

Chicken Scheme is largely R5RS compliant. In the basic version, however, are not all required by the standard numerical data types ( numerical tower ) is implemented, and there are other macros ( "explicit renaming ") is used instead of the macros of the language standards. However, these missing elements can be added using expansion modules.

The number of parameters of a procedure is limited in the current version to 126, on some common platforms are up to 1000 parameters supported.

Add-on Software

A large number of additional libraries and programs, the so-called Eggs, available for Chicken. These eggs are comparable to the Ruby Gems Ruby programming language.

Chicken is supported by SWIG Wrappergenerator.

182492
de