Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rotty/poco-scheme
A toy interpreter for a subset of Scheme
https://github.com/rotty/poco-scheme
Last synced: 24 days ago
JSON representation
A toy interpreter for a subset of Scheme
- Host: GitHub
- URL: https://github.com/rotty/poco-scheme
- Owner: rotty
- License: bsd-3-clause
- Created: 2019-07-25T21:19:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-31T21:35:56.000Z (about 5 years ago)
- Last Synced: 2024-10-10T20:28:31.833Z (about 1 month ago)
- Language: Rust
- Size: 79.1 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# An implementation of a tiny Scheme subset
This is an implementation of a (currently miniscule) subset of
R7RS-small. See [the examples directory](./scheme-examples) and the
[smoke tests](./tests/scheme/smoke.scm)for to get an idea of what
already works.The architecture is currently a fairly basic interpreter, with syntax
analysis phase up-front, which will transform the raw S-expressions
into an AST, which is then evaluated. This code sprang from code
intended as an example for using the [`lexpr`] crate to implement a
simple S-expression calculator, and got a bit out of hand 😀.The current architecture is insufficient to support several major
language features of Scheme, such as macros or continuations. The plan
is to gradually improve the implementation to make such features
possible, before investing in additional features based on the current
architecture.The evolution of poco-scheme will probably be largely guided by the
[chibi-scheme] codebase. chibi-scheme is a full implementation of
R7RS-small, written in C, employing a bytecode VM, and using syntactic
closures as the basic macro mechanism.## Features already present
- Proper tail calls.
- Garbage collection employing the `gc` crate.
- `define`, `lambda`, `if`.
- Fixnums, and some procedures working on numbers.
- A very crude version of `display` and `newline`, both without port arguments.## Next steps
- Basic cons cell support.
- Implement more syntax in `lexpr`:
- Quote syntactic shorthand (i.e. `'`).
- Add a transformation of the AST to some kind of bytecode.[chibi-scheme]: http://synthcode.com/wiki/chibi-scheme
[`lexpr`]: https://crates.io/crates/lexpr