https://github.com/jozefg/c_of_scheme
a lousy scheme compiler
https://github.com/jozefg/c_of_scheme
Last synced: 2 months ago
JSON representation
a lousy scheme compiler
- Host: GitHub
- URL: https://github.com/jozefg/c_of_scheme
- Owner: jozefg
- License: mit
- Created: 2014-10-23T18:03:22.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-23T18:13:10.000Z (over 10 years ago)
- Last Synced: 2025-01-28T16:34:40.536Z (4 months ago)
- Language: Haskell
- Homepage:
- Size: 609 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
A compiler for a kernel of Scheme.
Currently compiles a subset supporting
- Basic arithmetic
- Symbols
- First class continuations
- Tail calls
- Closures
- Mutation (which works with closures)The runtime system currently is the simplest possible implementation.
In particular, the current implementation of GC is rather leaky now,
as it only collects a certain subset of garbage for simplicity.
This will improve over time.## What's in c_of_scheme?
The full listing of primitive operations,- `+ - * /` with the obvious meanings
- `display` which prints any scheme value
- `cons car cdr`
- `eq?` for equalityAll programs must be a series of `define`'s, to execute actual values, use
(define _
(display (really-cool-function 0)))The same as you would do in SML.
## How do I run c_of_scheme?
To use `c_of_scheme`, simply run `make build` which will stick the rts in `~/.c_of_scheme` and give you
an excutable, `c_of_scheme` to run on a scheme file producing `a.out`.## Can I Contribute?
Absolutely! `c_of_scheme` is so small to make it a nice platform for hacking on a simple compiler.If you're interested in contributing anything, please email me at danny DOT gratzer AT gmail.com.
Some things that could be fun to work on include- A GC
- Any optimizations
- Adding some macros to make the generated C more legible
- A better UI for the command line
- Flags to print out the intermediate closure converted and CPSed code
- A pretty printer for intermediate languages
- A macro systemor anything else that interests you!
## How is `c_of_scheme` organized?
The compiler is under `src/`, the runtime system is under `c-bits/` and some
examples of compilable Scheme programs are under `test/`.