Chicken (Scheme implementation)

Chicken Scheme
Logo for Chicken Scheme
Chicken 5.0.0 interpreter running on macOS
ParadigmsMulti-paradigm: functional, imperative, meta
FamilyLisp
Designed byFelix Winkelmann
DeveloperThe Chicken Team
First appeared20 July 2000; 24 years ago (2000-07-20)[1]
Stable release
5.4.0 / 16 July 2024; 4 months ago (2024-07-16)
Typing disciplineDynamic, latent, strong
ScopeLexical
Implementation languageScheme, C
PlatformIA-32, x86-64, ARM, MIPS, SPARC64, PowerPC
OSCross-platform: Windows, Linux, macOS, FreeBSD, NetBSD, OpenBSD, Solaris, AIX, Haiku, Android, iOS
LicenseBSD
Filename extensions.scm
Websitewww.call-cc.org Edit this at Wikidata
Influenced by
Lisp, Scheme

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 mostly R5RS compliant and offers many extensions to the standard. The newer R7RS standard is supported through an extension library.[2] 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.[3] 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.[4]

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.[5] It also has built-in support for cross-compiling programs and extensions,[6] 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[7] 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.[8] 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.

Limitations and deviations from the standard

Chicken Scheme is mostly R5RS-compliant, with a few notable limitations and deviations.[9] R7RS compatibility is supplied as an extension library.[2]

The core system has basic support for UTF-8 characters, however the string indexing and manipulation procedures are not UTF-8 aware. An extension library exists which adds support for full UTF-8 awareness.[10]

Add-on software

Chicken has a large software repository of added libraries and programs, termed eggs.[11] This system is very similar to RubyGems.[12]

Initially, these eggs were developed in one central svn repository,[13] 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.[14] 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,[15] 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 most of R5RS standard 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,[16] Lua,[17] and Java, via Java Native Interface (JNI)[18] or a bridge.[19]

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.

Modules and macros

Since version 4, Chicken has a built-in module system and support for low-level hygienic macros through explicit renaming macros[20] (before version 4, this was available through an add-on library). Standard syntax-rules macros are also supported, and implicit renaming macros,[21] which is basically a reversed version of explicit renaming.

This mechanism trades performance for convenience. Each identifier not explicitly injected as unhygienic will be automatically renamed to avoid name capture. The performance cost occurs because implicit renaming requires the macro-expander to retraverse the expressions two more times. This cost is paid at expansion time, so a macro author must consider if longer compiling times are acceptable.

Remote debugger

Since version 4.11, Chicken comes shipped with a debugger named Feathers.[22] When Scheme code is compiled with the needed debugging option, debugging events are injected at specific points in the code. These are implemented as calls to a C function, which is relatively low-overhead when not actually debugging the code. When debugging, it will try to make a TCP connection to a Feathers server process, possibly on a different machine. The process is halted, the user may set breakpoints and start the program. Then, when the breakpoint is hit, the client (process being debugged) enters a command loop, which allows interrogation of the client, to read out variables, or mutate them.

Limited static type analysis

Chicken supports local flow analysis. This allows the compiler to catch variable type errors at compile-time, and perform type specialisation. This specialisation makes it possible to remove several safety checks for type detection at runtime when the type can be deduced at compile-time. This results in improved run-time performance.

This scrutinizer does not allow cross-module flow analysis, so it can only be used to optimize code that's part of one compiling unit (or module).

History

CHICKEN Scheme was originally developed by Felix Winkelmann on Cygwin/gcc and later Visual C++ 5.0 on Windows 98.[1] He came up with the name "CHICKEN" arbitrarily as the "first thing that came to my mind that day" thinking of a plastic toy of Feathers McGraw on his desk. As the project matured, he decided not to change the name out of superstition.[23]

See also

References

  1. ^ a b Winkelmann, Felix. "Announcing the Chicken Scheme-to-C compiler". Google Groups (comp.lang.scheme).
  2. ^ a b evhan (2018-11-09). "r7rs (Chicken manual)". Chicken Scheme. Retrieved 2019-02-28.
  3. ^ "Scheme FAQ"., section "what is Scheme used for?"
  4. ^ Bex, Peter (sjamaan) (2018-08-16). "Software written in Chicken Scheme". Chicken Scheme. Retrieved 2019-02-26.
  5. ^ "Portability". Chicken Scheme Wiki.
  6. ^ Bex, Peter (sjamaan) (2016-05-28). "Cross development". Chicken Scheme (Manual). Retrieved 2019-02-26.
  7. ^ Baker, Henry (1994). "CONS Should Not CONS Its Arguments, Part II: Cheney on the M.T.A." Archived from the original on 2006-03-03.
  8. ^ Cheney, C.J. "A Nonrecursive List Compacting Algorithm". CACM 13,11 (Nov. 1970), 677-678.
  9. ^ Bex, Peter (sjamaan); Winkelmann, Felix (2016-05-28). "Confirmed deviations (Chicken manual)". Chicken Scheme. Retrieved 2019-02-28.
  10. ^ Bex, Peter (sjamaan); kooda; mario; svnwiki; wasamasa; kon; mario (2018-08-11). "utf8 (Chicken manual)". Chicken Scheme. Retrieved 2019-02-28.
  11. ^ "Chicken eggs". Chicken Scheme.
  12. ^ "RubyGems". RubyGems.org. Retrieved 2019-02-26.
  13. ^ Bex, Peter (sjamaan). "VCS-independent distribution of language extensions"., blogpost on More magic
  14. ^ "Instructions for popular code hosting methods and VCSes". Chicken wiki.
  15. ^ "Chicken automated tests". Chicken Scheme. Retrieved 2019-02-28.
  16. ^ iraikov (2016-06-11). "pyffi". Chicken Scheme Wiki. Retrieved 2019-03-03.
  17. ^ Bex, Peter (sjamaan); iraikov (2012-03-11). "Lua". Chicken Scheme Wiki. Retrieved 2019-03-03.
  18. ^ mario; svnwiki (2013-06-04). "JNI". Chicken Scheme Wiki. Retrieved 2019-03-03.
  19. ^ Winkelmann, Felix; mario (2013-06-04). "Javahack". Chicken Scheme Wiki. Retrieved 2019-03-03.
  20. ^ Bex, Peter (sjamaan); Winkelmann, Felix; mario (2018-09-23). "Module (Chicken syntax)". Chicken Scheme. Retrieved 2019-02-28.
  21. ^ Bex, Peter (sjamaan); Winkelmann, Felix; mario (2018-09-23). "Module (Chicken syntax)". Chicken Scheme. Retrieved 2019-02-28.
  22. ^ Bex, Peter (sjamaan) (2018-11-25). "Debugging". Chicken Scheme.
  23. ^ Croisant, John (2013-06-19). "Behind the Scenes with CHICKEN Scheme and SPOCK (Part 2)". Atomic Spin. Retrieved 2023-02-17.

Read other articles:

1917 film by James Vincent Sister Against SisterDirected byJames VincentWritten byMary MurilloStarringVirginia PearsonMaud Hall MacyWalter LawCinematographyRené GuissartProductioncompanyFox FilmDistributed byFox FilmRelease dateMarch 4, 1917Running time50 minutesCountryUnited StatesLanguagesSilentEnglish intertitles Sister Against Sister is a 1917 American silent drama film directed by James Vincent and starring Virginia Pearson, Maud Hall Macy and Walter Law.[1] Cast Virginia Pearso...

 

 

  هذه المقالة عن جمهورية زائير السابقة. لمعانٍ أخرى، طالع زائير (توضيح). جمهورية زائير Republique De Zaire   1971 – 1997 زائيرعلم زائيرشعار النشيد : انهضوا يا كونغوليون زائير بالأخضر عاصمة كينشاسا نظام الحكم جمهورية اللغة الرسمية الفرنسية  اللغة فرنسية الديانة المسيح...

 

 

For the former Severn & Wye Railway station, see Lydney Junction railway station. Railway station in Gloucestershire, England LydneyGeneral informationLocationLydney, Forest of DeanEnglandCoordinates51°42′54″N 2°31′52″W / 51.715°N 2.531°W / 51.715; -2.531Grid referenceSO633020Managed byTransport for WalesPlatforms2Other informationStation codeLYDClassificationDfT category F1HistoryOpened1851Passengers2017/18 0.196 million2018/19 0.199 million2019/20 0.1...

Maltese footballer Dorianne Theuma Theuma in action for HiberniansPersonal informationDate of birth (1984-05-17) 17 May 1984 (age 39)Place of birth MaltaPosition(s) MidfielderTeam informationCurrent team Swieqi UnitedSenior career*Years Team Apps (Gls)1997–2008 Hibernians 2008–2013 Mosta 2013–2019 Hibernians 2019– Swieqi International career‡2003– Malta 114 (29) *Club domestic league appearances and goals, correct as of 14:10, 14 March 2020 (UTC)‡ National team caps and goa...

 

 

Cutberto de Lindisfarne, fresco medieval en la catedral de Durham. San Cutberto de Lindisfarne (c. 634-20 de marzo de 687), monje y obispo anglosajón, uno de los más importantes santos de la Inglaterra medieval y santo patrón de Northumbria. Su fiesta se celebra el 20 de marzo. Era originario de Northumbria, probablemente de Dunbar, hoy en Escocia. Aunque era joven pastor, tuvo una visión una noche del alma de Aidan de Lindisfarne, un misionero cristiano que reavivó el cristianismo en No...

 

 

Online database of digital objects stored in electronic media formats and accessible via computers Elibrary redirects here. For the former online library eLibrary, see HighBeam Research. A digital library, also called an online library, an internet library, a digital repository, a library without walls, or a digital collection, is an online database of digital objects that can include text, still images, audio, video, digital documents, or other digital media formats or a library accessible t...

Non-elected workforce of the US government This article is part of a series on thePolitics of the United States Federal government Constitution of the United States Law Taxation Policy Legislature United States Congress House of Representatives Speaker Mike Johnson (R) Majority Leader Steve Scalise (R) Minority Leader Hakeem Jeffries (D) Congressional districts (List of congressional districts) Senate President Kamala Harris (D) President Pro Tempore Patty Murray (D) Majority Leader Chuck Sch...

 

 

Peta Lokasi Kabupaten Tulang Bawang di Lampung Berikut ini adalah daftar kecamatan dan kelurahan/desa di kabupaten Tulang Bawang, Provinsi Lampung, Indonesia. Kabupaten Tulang Bawang terdiri dari 15 kecamatan, 4 kelurahan, dan 147 desa. Pada tahun 2021, jumlah penduduknya mencapai 430,630 jiwa dengan luas wilayah 3.466,32 km² dan sebaran penduduk 124 jiwa/km².[1][2] Daftar kecamatan dan kelurahan di Kabupaten Tulang Bawang, adalah sebagai berikut: Kode Kemendagri Kecamatan J...

 

 

Chinese television series Royal NirvanaTraditional Chinese鶴唳華亭Simplified Chinese鹤唳华亭Hanyu PinyinHèlì Huátíng GenreHistorical fictionPoliticalBased onHe Li Hua Ting by Xue Man Liang YuanWritten byXue Man Liang YuanDirected byYang WenjunStarringLuo JinLi YitongCountry of originChinaOriginal languageMandarinNo. of episodes60ProductionExecutive producerWu RuoyanProducersMei ZixiaoHuang YilongProduction locations Xiangshan Film and Television Town, Zhejiang Wuxi, Jiangsu I...

Este artículo o sección necesita referencias que aparezcan en una publicación acreditada.Este aviso fue puesto el 2 de febrero de 2020. Policía Secreta Prusiana Preußische Geheimpolizei Escudo de PrusiaLocalizaciónPaís Prusia República de WeimarInformación generalTipo policía política y policía secretaHistoriaFundación 1854Disolución 26 de abril de 1933 (absorbida por la Gestapo)Sucesión Policía Política Secreta ←Policía Secreta Prusiana→ Gestapo [editar datos en Wi...

 

 

Place in Muchinga Province, ZambiaNakondeNakondeLocation in ZambiaCoordinates: 09°19′38″S 32°45′30″E / 9.32722°S 32.75833°E / -9.32722; 32.75833Country ZambiaProvinceMuchinga ProvinceDistrictNakonde DistrictElevation4,285 ft (1,306 m)Population (2018 Estimate) • Total10,652Time zoneUTC+2 (CAT) Nakonde is a town in the Muchinga Province of Zambia, on the border with Tanzania. It is at the northern end of Zambia's Great North Road (...

 

 

Rank of the navy of the United Kingdom Vice-Admiral of the WhiteCommand flag (1805–1864)Country United KingdomService branchRoyal NavyAbbreviationVAWNext higher rankVice-Admiral of the RedNext lower rankVice-Admiral of the Blue Vice-Admiral of the White was a senior rank of the Royal Navy of the United Kingdom, immediately outranked by the rank Vice-Admiral of the Red (see order of precedence below). Royal Navy officers holding the ranks of commodore, rear admiral, vice admiral and adm...

Onthophagus dandalu Onthophagus dandalu Klasifikasi ilmiah Kerajaan: Animalia Filum: Arthropoda Kelas: Insecta Ordo: Coleoptera Famili: Scarabaeidae Genus: Onthophagus Spesies: Onthophagus dandalu Onthophagus dandalu adalah spesies kumbang yang berasal dari genus Onthophagus dan famili Scarabaeidae. Kumbang ini juga merupakan bagian dari ordo Coleoptera, kelas Insecta, filum Arthropoda, dan kingdom Animalia. Kumbang ini memiliki antena yang terdiri dari plat yang disebut lamela. Referensi Bis...

 

 

R. Ediwan PrabowoInformasi pribadiLahir4 Oktober 1961 (umur 62)JakartaSuami/istriNy. Shinta RengganisAnak1. Arief N2. Agung W3. Asih LTempat tinggalJakarta, IndonesiaAlma materAkademi Militer (1984)Penghargaan sipilAdhi Makayasa - Tri Sakti Wiratama 1984Karier militerPihak IndonesiaDinas/cabang TNI Angkatan DaratMasa dinas1984–2019Pangkat Letnan Jenderal TNISatuanArtileri MedanSunting kotak info • L • B Letnan Jenderal TNI (Purn.) R. Ediwan Prabowo, S.I.P. (lahi...

 

 

Grand Prix Sepeda Motor F.I.M. musim 1999 Sebelum: 1998 Sesudah: 2000 Juara Dunia 1999500cc – Àlex Crivillé (Honda)250cc – Valentino Rossi (Aprilia)125cc – Emilio Alzamora (Honda) Àlex Crivillé (foto di Rio de Janeiro) menjadi juara 500ccValentino Rossi (foto di Donington Park) menjadi juara 250cc Grand Prix Sepeda Motor musim 1999 adalah musim Kejuaraan Dunia F.I.M. ke-50. Ringkasan Musim Dominasi dari Mick Doohan telah berakhir dengan cedera serius yang dialami oleh Mick Doohan pa...

Hashihime as appearing in the Kyōka Hyaku-Monogatari from 1853 Hashihime (橋姫) (the maiden of the bridge[1]) is a character that first appeared in Japanese Heian-period literature, represented as a woman who spends lonely nights waiting for her lover to visit, and later as a fierce “oni” or demon fueled by jealousy. She came to be associated most often with a bridge in Uji. Biography Very little is known about the origin of Hashihime. The most common interpretation is that she...

 

 

Harad El Señor de los Anillos de J. R. R. TolkienBanderaEscudo La bandera de Harad es un paño rojo con una serpiente negra.InformaciónTipo PaísSignificado del nombre Sindarin: «Sur»Localización Tierra MediaPoblación HaradrimFronteras Gondor, Mordor y Khand [editar datos en Wikidata] En el Universo Imaginario de J. R. R. Tolkien, Harad (Sindarin: «Sur»; en Quenya: Hyarmen) era el nombre dado a las vastas tierras al sur de Gondor y Mordor. Los hombres de Harad eran llamados ...

 

 

The Arthurian knight Isdernus (Yder) as depicted on the archivolt of Modena Cathedral (1120-40). Edern ap Nudd (Latin: Hiderus;[1] Old French: Yder[2] or Ydier) was a knight of the Round Table in Arthur's court in early Arthurian tradition. As the son of Nudd (the Nu, Nut or Nuc of Old French, Arthurian romance), he is the brother of Gwyn, Creiddylad, and Owain ap Nudd. In French romances, he is sometimes made the king of a separate realm. As St Edern, he has two churches...

Filipino international television channel This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Kapatid Channel – news · newspapers · books · scholar · JSTOR (July 2023) (Learn how and when to remove this template message) Television channel Kapatid ChannelCountryPhilippinesBroadcast areaInternationalNetworkTV5Hea...

 

 

Parque de Bombas, built in 1882, is one of Puerto Rico's most photographed structures Ponce, Puerto Rico's second-largest city outside the San Juan metropolitan area, receives over 100,000 visitors annually.[1] Ponce's sights include monuments and architecture, such as its Monumento a la Abolición de la Esclavitud and Residencia Armstrong-Poventud, and pink marble curbs and chamfered streets corners, as well as historic houses, castles and concert halls. There are also more modern at...

 

 

Strategi Solo vs Squad di Free Fire: Cara Menang Mudah!