Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apg/surd
an absurd lisp interpreter
https://github.com/apg/surd
Last synced: 2 months ago
JSON representation
an absurd lisp interpreter
- Host: GitHub
- URL: https://github.com/apg/surd
- Owner: apg
- Created: 2012-03-03T17:15:16.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T07:13:11.000Z (10 months ago)
- Last Synced: 2024-05-14T00:26:47.539Z (9 months ago)
- Language: C
- Homepage:
- Size: 78.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- AwesomeInterpreter - surd
README
Surd - An absurd Lisp interpreter
---------------------------------This really doesn't do much but serve as an example of constructing a
very basic Lisp interpreter in C. It may, in the future serve as the
basis for a larger project, but currently is absurd.It supports abstraction, lists, symbols and fixnums. It does support
top level definitions with the `def` keyword, but at the moment doesn't
support "fancy forms" such as `let` and `letrec` nor does it support
macros. There's no first class `eval` or a way to report the current
lexical environment. But, everything *is* built out of conses and
cells, including closures. Closures are tagged as such, but stored
using the same cell fields that a cons uses.In other words:
c = cell()
c.type = CLOSURE
c.car = CODE
c.cdr = ENVWhere as a cons:
c = cell()
c.type = CONS
c.car = CAR
c.cdr = CDROf course you can evaluate expressions:
$ ./surd
surd 0> (((fn (y) (fn (x) (+ x y))) 1) 2)
result 0: 3The Allocator / GC
==================surd uses libgc for now, though it did at one point use the one-pass
mark-sweep as described by Armstong and Virding in "One Pass
Real-Time Generational Mark-Sweep Garbage Collection (1995)"
([link](http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.42.7791))To do
=====1. Generational collection -- this should be easy
2. Box top level definitions so that they can be replaced
3. First class `read`, `write`, `eval`.
4. Implement let, letrec (might require a special rec form)
5. tail-call optimization.
6. Larger standard library implemented in surd.
7. hygienic defmacros and quasiquote, unquote, unquote-splicing
8. ...