ArticleslgStudy

computer science

Chicken (Scheme implementation)

Chicken (Scheme implementation) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Chicken (Scheme implementation) rather than just read about it. In short: Chicken (stylized as CHICKEN) is a programming language, specifically a compiler and interpreter which implement a dialect of the programming language Scheme, and which compiles Scheme source code to standard C. It is R7RS compliant and offers many extensions to the standard.

Chicken (Scheme implementation) — main illustration
Chicken (Scheme implementation) — illustration

Key takeaways

  • Chicken (Scheme implementation) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Chicken (Scheme implementation) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Chicken (Scheme implementation) from memory before moving on to harder problems.

Reference excerpt

Chicken (stylized as CHICKEN) is a programming language, specifically a compiler and interpreter which implement a dialect of the programming language Scheme, and which compiles Scheme source code to standard C. It is R7RS compliant and offers many extensions to the standard. Chicken is free and open-source software available under a BSD license. It is implemented mostly in Scheme, with some parts in C for performance or to make embedding into C programs easier.

Focus Chicken's focus is quickly clear from its slogan: "A practical and portable Scheme system". Chicken's main focus is the practical application of Scheme for writing real-world software. Scheme is well known for its use in computer science curricula and programming language experimentation, but it has seen little use in business and industry. Chicken's community has produced a large set of libraries to perform a variety of tasks. The Chicken wiki (the software running it is also a Chicken program) also contains a list of software that has been written in Chicken. Chicken's other goal is to be portable. By compiling to an intermediate representation, in this case portable C (as do Gambit and Bigloo), programs written in Chicken can be compiled for common popular operating systems such as Linux, macOS, other Unix-like systems, Windows, Haiku, and mobile platforms iOS and Android. It also has built-in support for cross-compiling programs and extensions, which allows it to be used on various embedded system platforms.

Design Like many Scheme compilers, Chicken uses standard C as an intermediate representation. A Scheme program is translated into C by the Chicken compiler, and then a C compiler translates the C program into machine code for the target computer architecture, producing an executable program. The universal availability of C makes it useful for this purpose. Chicken's design was inspired by a 1994 paper by Henry Baker that outlined an innovative strategy to compile Scheme into C. A Scheme program is compiled into C functions. These C functions never reach the return statement; instead, they call a new continuation when complete. These continuations are C functions and are passed on as extra arguments to other C functions. They are calculated by the compiler. So far, this is the essence of continuation-passing style. Baker's novel idea is to use the C call stack for the Scheme heap. Hence, normal C stack operations such as automatic variable creation, variable-sized array allocation, and so on can be used. When the stack fills up (that is, the stack pointer reaches the top of the stack), a garbage collection can be initiated. The design used is a copying garbage collector originally devised by C. J. Cheney, which copies all live continuations and other live objects to the heap. Despite this, the C code does not copy C stack frames, only Scheme objects, so it does not require knowledge of the C implementation. In full, the Scheme heap consists of the C stack as the nursery together with the two heaps required by the generational garbage collector. This approach gives the speed of the C stack for many operations, and it allows the use of continuations as simple calls to C functions. Further, Baker's solution guarantees asymptotic tail recursive behavior, as required by the Scheme language standard. The implementation in the Chicken Scheme compiler is even asymptotically safe for space.

Add-on software Chicken has a large software repository of added libraries and programs, termed eggs. This system is very similar to RubyGems. Initially, these eggs were developed in one central svn repository, in which creating a tag would automatically cause a new version of the extension to become available for download. Currently, eggs can be developed anywhere and under any version control system, while still maintaining semi-automatic release management when using most of the popular code hosting sites. This release method is VCS-agnostic in the sense that the user does not need to have these VCSes installed. The developer is free to host anywhere they choose, and can even choose to avoid public version control and distribute only plain tarballs. For all released eggs, the latest version is tested automatically as part of a continuous integration process. A canonical test server exists, where the core system and all eggs are tested daily against the most recent development version (to catch regressive bugs), and the most recent stable version (to ensure that everything works for users of the stable system). Also, anyone can volunteer to supply further testing capacity, on different: hardware, operating systems, or core releases.

Features CHICKEN supports almost the full R5RS and R7RS small standards of Scheme, but it also adds a few nonstandard features which are not available in all Scheme implementations.

Foreign function interface CHICKEN compiling to C makes it possible to inject custom C code into the compiled result, which eases integrating with C libraries. Its foreign function interface supports converting back and forth between most built-in C types and corresponding Scheme objects. Also, extension libraries exist for interfacing to Python, Lua, and Java, via Java Native Interface (JNI) or a bridge.

Cross-compiling It is relatively easy to cross-compile Scheme code to another platform (for example for embedded use on a device). To make cross-compiling possible for Scheme code, CHICKEN imposes a model of separate compiling: A compiled module consists of two shared libraries. One library contains the actual code which will be used at runtime (compiled for the target platform), and the other is an import module, which will be used to load the code which runs at compile-time (on the host platform), such as procedural macro code. The CHICKEN compiler can also be easily cross-compiled. After translation to C has been achieved, one can simply use a C compiler which is set up to build for another platform.

… excerpt ends here. Continue reading the full article.

Illustrations

Chicken (Scheme implementation) illustration
Chicken (Scheme implementation) illustration

Worked examples

Example 1 — a first encounter with Chicken (Scheme implementation)

Start with the simplest possible case. Write down what Chicken (Scheme implementation) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Chicken (Scheme implementation) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Chicken (Scheme implementation) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Chicken (Scheme implementation)

In research
Chicken (Scheme implementation) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Chicken (Scheme implementation) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Chicken (Scheme implementation) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Free and open source compilers, Free and open source interpreters, Scheme (programming language) compilers, so understanding it makes those chapters shorter.
In everyday life
Look for Chicken (Scheme implementation) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Chicken (Scheme implementation)” →

How to study Chicken (Scheme implementation) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Chicken (Scheme implementation) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Chicken (Scheme implementation) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Chicken (Scheme implementation) in simple terms?

Chicken (stylized as CHICKEN) is a programming language, specifically a compiler and interpreter which implement a dialect of the programming language Scheme, and which compiles Scheme source code to standard C. It is R7RS compliant and offers many extensions to the standard.

Why does Chicken (Scheme implementation) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Chicken (Scheme implementation)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Chicken (Scheme implementation).

Tags

  • Free and open source compilers
  • Free and open source interpreters
  • Scheme (programming language) compilers
  • Scheme (programming language) implementations
  • Scheme (programming language) interpreters
  • Software using the BSD license

Keep exploring