Teeny Scheme
Where TinyScheme is a word, Teeny Scheme is a jargonism. Short, modern, snappy, likely to be forgotten and abandoned real soon. Probably Smells Like Teen Spirit.
Teeny Scheme [repository] is a fork of TinyScheme maintaining the original’s focus on smallness. But with some more values added on top: readability and strictness. The code should be readable and easily modifiable. In part because it should scream at you if something goes wrong.
Getting Started
Teeny Scheme has really low requirements:
- A C99+ compiler
- POSIX Make
- (Optional) math library
- (Optional) libdl for dynamic library loading
- (Optional) utf8proc library for Unicode / UTF-8 support
What’s left is cloning and building it:
$ git clone https://codeberg.org/aartaka/teenyscheme $ cd teenyscheme $ make all $ ./teenyscheme -h Usage: ./teenyscheme -h ./teenyscheme ./teenyscheme [<file1> <file2> ...] ./teenyscheme [<file1> <file2> ...] -1 <file> [<arg1> <arg2> ...] ./teenyscheme [<file1> <file2> ...] -c <expr> [<arg1> <arg2> ...] Use - as filename for stdin. $ sudo make install $ teenyscheme
You don’t really need Make, in fact. You only need to build scheme.c and optionally dynload.c. It’s all of the interpreter in a single file. Well, there are headers, but these are inlined at build time, so who cares. One final executable. Valuable, I believe.
Teeny Scheme Values
- Smallness
- If scheme.c grows beyond 10KLoC, this project has failed. Optimal size hovers around 6-7KLoC and I’ll try to preserve that.
- Readability
- A lot of syntactic sugar and… interesting stylistic choices are made. See CONTRIBUTING.md for the explanation of these. And for how you should adopt them.
- Strictness
- Compiler should enforce as much as possible.
So: strict types (booleans, width-restricted integers,
nullptr,size_t) and a lot of compiler flags to check suspicious behaviors. - Configurability / optionality
- Most features should be disableable, either at compile-time or launch-time. See scheme.h for a list of macros determining behaviors.
- Zero slop policy
- This is a project created in part as a response to many small Schemes succumbing to Generative AI. This small Scheme will have zero slop, I can promise you that.
There’s a number of non-values too:
- C89 compatibility
- It’s dated and un-ergonomic. If you want C89, use the original TinyScheme.
- Preservation of the original TinyScheme code.
- It is only preserved in spirit. Huge refactoring has already been done, so it might look real different from the original. In a good way, supposedly.
Documentation
There currently are two manuals for Teeny Scheme. The modern manual is hypertextual and relevant to the current state of Teeny. While the original TinyScheme manual is dated, but still contains important info on, e.g., using Teeny as an embedded library. I hope to move all of the useful info to the modern manual, but it might take time and effort. Help appreciated!
Acknowledgements
Teeny Scheme is a fork of TinyScheme R7. TinyScheme R7 is a fork of classic TinyScheme. And TinyScheme itself is a fork of MiniScheme. Which means: a lot of work has gone into making this project work. I do not claim any credit for it and I’m grateful to the people that I took this code from. Please respect their work. See AUTHORS file.
License
Teeny is disctibuted under the terms of BSD 2-clause license.