Add readme

This commit is contained in:
Francesco Magliocca 2022-05-24 17:08:52 +02:00
commit 5e5dddb3ba
1 changed files with 55 additions and 0 deletions

55
README.md Normal file
View File

@ -0,0 +1,55 @@
# leao
minimal scheme dialect implementation written in ISO C11 meant to be used
to write interpreters and compilers (that can therefore be easily bootstrapped).
## How to build
This project uses **GNU Make**, in order to build it, run in your shell:
> $ make
## leao features (or better, limitations)
Here is a list of features that are planned:
* Input source code can be encoded in UTF-8, but identifiers are very limited (cfr. `src/parser.c`)
* There are only integers (probably int64_t) and integer arithmetic
* **box** primitive datatype, being the only one that allows mutation, all the other values are immutable
* First class functions
* First class undelimited continuations (maybe? I'm not sure yet, but they seem easy to implement)
* First class delimited continuations (seem easy)
* Hygienic macros (this is very hard, even less sure, but they can help in writing an interpreter)
## Implementation notes
I'd like to implement a virtual machine influenced by the second architecture (stack based virtual machine)
exposed in Dybvig's thesis `Three Implementation Models for Scheme`.
Observe that the odd (for scheme) requirement of having all immutable values except for the **box** datatype
is to allow for a slightly optimised virtual machine implementation.
In fact by making the user manually mark the mutable values in the program, the compiler can spare
some heap allocations when needed.
Actually this limitation is not necessary at all, in fact the interpreter can do some analysis and automatically
determine whether a variable can be mutated or not, but at the moment i like the idea of having explicitly
marked mutations, it seems more functional (the idea is copied from _Standard ML_).
This limitation will probably change in the future.
For the garbage collection I'll get started with the Cheney's algorithm, which is pretty easy to implement.
Maybe later a different algorithm may be due.
### Core language
Since we want to hopefully implement macros, we start defining what the core, target, language looks like.
It has the following syntactic forms, whose semantics can be looked up on the R7RS standard:
* define
* let, letrec
* lambda
* quote
* if
* begin