Chicken (Scheme)
Chicken
|
|
---|---|
Basic data
|
|
Publishing year | July 20, 2000 |
Current version | 5.1.0 (June 18, 2019) |
operating system | Platform independent |
programming language | Scheme |
category | programming language |
License | BSD |
call-cc.org |
Chicken is a compiler and interpreter for the Scheme programming language that translates the Scheme source code to C. Chicken is largely R 5 RS compliant and offers many extensions to this standard. It is free software that is distributed under a BSD license . The author is Felix Winkelmann.
design
Like many Scheme compilers, Chicken uses the C programming language as intermediate code . Scheme programs are translated to C by the Chicken compiler and then translated by a standard C compiler into the machine language of the target system, which can then be executed. The widespread use of C compilers allows extensive platform independence .
Chicken's design was inspired by a 1994 publication by Henry G. Baker that described an innovative way to translate Scheme to C. Here, a scheme program is translated into C functions, which do not return to the caller, but instead call a so-called continuation after completion . These continuations are further C functions that are generated by the Chicken compiler and 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 a scheme heap . Therefore, normal stack operations such as automatic variable creation , alloca calls to create arrays of variable sizes and the like can be used. As soon as the stack is full, a garbage collection is started to empty the stack again. The chicken design uses a copying garbage collector , first described by CJ Cheney in 1970. All of the Scheme objects and continuations that are still in use are moved to the heap, but no C-Stack frames are moved, which means that Chicken does not know the underlying C implementation.
This approach gives many operations the speed of normal stack operations, especially calling the continuations is a simple function call. Furthermore, the end-recursive behavior required by Scheme can be achieved without the memory requirement increasing excessively.
Limitations and deviations from the standard
Chicken Scheme is largely R 5 RS-compliant. Other macros (" explicit renaming ") are used instead of the macros of the language standard.
Add-on software
A large number of additional libraries and programs, called eggs , are available for Chicken. These eggs are comparable to the Ruby Gems in the Ruby programming language .
Individual evidence
- ↑ Henry Baker: CONS Should Not CONS Its Arguments, Part II: Cheney on the MTA , ACM SIGPLAN Notices 30, (1995), 17-20, doi : 10.1145 / 214448.214454
- ↑ CJ Cheney: A nonrecursive List Compacting Algorithm . In: CACM . tape 13 , no. 11 , 1970, pp. 677-678 , doi : 10.1145 / 362790.362798 .