Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darius/ichbins
A tiny self-hosting Lisp-to-C compiler
https://github.com/darius/ichbins
compiler language lisp
Last synced: 2 months ago
JSON representation
A tiny self-hosting Lisp-to-C compiler
- Host: GitHub
- URL: https://github.com/darius/ichbins
- Owner: darius
- Created: 2010-07-06T02:16:53.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2020-06-28T16:49:38.000Z (over 4 years ago)
- Last Synced: 2024-08-02T16:36:30.074Z (5 months ago)
- Topics: compiler, language, lisp
- Language: C
- Homepage:
- Size: 111 KB
- Stars: 234
- Watchers: 11
- Forks: 23
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
- my-awesome-github-stars - darius/ichbins - A tiny self-hosting Lisp-to-C compiler (C)
- AwesomeCompiler - ichbins
README
ICHBINS
This is a self-hosting compiler of a Lisp dialect to C in 6 pages of
code. I've tried to make it as simple as possible, with almost no
concessions to performance or extra functionality -- it's meant to be
educational rather than useful.QUICK START
$ git clone [email protected]:darius/ichbins.git
(Or get a tarball from http://github.com/darius/ichbins)
$ cd ichbins
$ makeTo compile a program named foo.scm and then run it:
$ ./ichbins foo.c
$ cc foo.c -o foo
$ ./fooThere's a sketchy overview of the language and system in Overview.text.
To make a change to the compiler and rebuild it, just typing 'make'
isn't sufficient because of the circular dependency. 'make' will build
an executable named ichbins2, compiling the current source with the
previous executable. To replace that executable, type './bless', which
does two tests:* That the tests in the tests/ directory pass.
* That the old and new versions of the compiler executable produce
the same C output from the compiler source. This test typically
passes for routine changes to the source, but it's perfectly OK
for it to fail; you should just be sure you can say why this case
is expected. Then do 'mv ichbins2 ichbins' by hand and do ./bless
again; this time it must pass, or something's buggered.The Lisp dialect implemented here is documented in Documentation.md.
MOTIVATION
I'm a nut who wants to grow a beautiful wholeness from tiny beginnings.
This is a rewrite of 'icbins', which had the same larger goal in mind
but a more immediate focus on playing with bootstrapping.Direct influences include:
Steele & Sussman, "The Art of the Interpreter"
http://library.readscheme.org/page1.htmlMarc Feeley, "Scheme in 90 Minutes"
http://www.iro.umontreal.ca/~boucherd/mslug/meetings/20041020/minutes-en.html
(which compiles a more powerful Scheme subset, but is longer and not
self-hosting)The name 'ichbins' could stand for "I Can Hardly Believe It's Not Scheme!"
See also https://github.com/darius/elv for a more featureful descendant.
THANKS
To Johnicholas Hines for example code.
To Manuel Simoni and Kragen Sitaker for feedback.
LICENSE & CONTACT
Copyright 2007 Darius Bacon under the terms of the MIT X license
found at http://www.opensource.org/licenses/mit-license.htmlDarius Bacon