Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jtolio/scheme2cps2c4py
A Scheme to CPS to C compiler in Python
https://github.com/jtolio/scheme2cps2c4py
Last synced: 23 days ago
JSON representation
A Scheme to CPS to C compiler in Python
- Host: GitHub
- URL: https://github.com/jtolio/scheme2cps2c4py
- Owner: jtolio
- License: mit
- Created: 2010-09-02T17:05:57.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2010-09-03T19:57:17.000Z (about 14 years ago)
- Last Synced: 2023-03-11T03:47:35.043Z (over 1 year ago)
- Language: Python
- Homepage: http://www.jtolds.com/projects/
- Size: 125 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
python scheme compiler
jt oldsusage:
./compiler.py < input.scm > out.c
./compiler.py --output=c < input.scm > out.calternatively:
./compiler.py --output=cps < input.scm > output.scmother flags include
--curry if you want the intermediate representation to curry all
function calls, why you would i don't know
--recursion_limit if you are having trouble with call depth size of the
python interpreter.
--nogc disables usage of the boehm garbage collector
(not recommended)the story so far:
this is a scheme-to-c compiler written in python. it does not support all of
r5rs by any means (there aren't many valid data types besides integers. lists
aren't supported, for example (bwa?!)), but it is a definitely solid starting
point.
the biggest novelty of this compiler is that it compiles by first transforming
scheme to continuation-passing-style, which means that call/cc actually does
work.
i wrote this for advanced compilers (cs6470) with matt might (matt.might.net)
at utah.edu. it was a tight schedule and i barely made it, so the documentation
is poor, and there are two intermediate representations (instead of fixing the
initial ir once i realized it was broken, i just wrote a quick translator for
the ir instead of rewriting the other code).
at some point i definitely hope to clean this up.