From 96d27c2a3e1a0fa0878beb3f9cd02f4b4ed8fdbb Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Fri, 8 Oct 2021 10:25:59 +0200 Subject: Initial commit w/ small readline echo function --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100755 index 0000000..4caf1c3 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# Bad Diode's Lisp + +For some time I've been meaning to learn more about compilers and programming +language theory. And so I found myself again delving into a rabbit hole of +wheel-reinvention for the purpose of fun and learning. + +The goals for this project are to build a programming language that can be +interpreted directly from a VM and with support for compilation to assembly +(`x86_64` and/or `ARM (thumb or aarch64)`). It could make sense to output +bytecode for LLVM to take advantage of the built in optimizations, but let's +just go one step at a time. At the time I know some ARM assembly, but I'm not so +versed in `x86_64` and know nothing of LLVM bytecode. + +I've chosen to implement a Lisp, perhaps a subset of Scheme. The syntax is not +so important for now, maybe in the future the compiler will take a different +home-brew language, but hopefully this helps setting the fundamentals for +a minimal working compiler. In principle, we could keep the internal +representation and language working as a lisp, but with a different external +syntax. + +The language should have built-in structures for dynamic arrays, hash tables, +strings (and string views). It should be suitable for use in embedded systems +and be linked seamlessly with other compiled objects. + +Accessing system resources, such as stdio or graphics could be done via function +calls to the give APIs. This should help decouple the CPU logic from hardware, +hopefully facilitating porting programs to different platforms (GBA, Rasberry +Pi, etc.). + +The current plan is to build a bootstrap interpreter in C that can be used to +generate the self-hosted version of itself. I'll try to document the process +here as best as I can. + +The bootstrap implementation should be kept simple, since we can focus on +optimization once we have a self-hosting compiler. + +# Resources + +- [Structure and Interpretation of Computer Programs][sicp] +- [Crafting Interpreters][crafting-interpreters] +- [Building a Scheme from scratch][scheme-from-scratch] +- [Compiling a Lisp][compiling-a-lisp] +- [An Incremental Approach to Compiler Construction][ghuloum11] +- [Make-A-Lisp Guide][mal] +- [An Introduction to Scheme and its Implementation][intro-to-scheme-and-imp] + +[sicp]: https://mitpress.mit.edu/sites/default/files/sicp/index.html +[crafting-interpreters]: https://craftinginterpreters.com/ +[scheme-from-scratch]: http://peter.michaux.ca/articles/scheme-from-scratch-introduction +[compiling-a-lisp]: https://bernsteinbear.com/blog/compiling-a-lisp-0/ +[ghuloum11]: http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf +[mal]: https://github.com/kanaka/mal/blob/master/process/guide.md +[intro-to-scheme-and-imp]: https://www.cs.utexas.edu/ftp/garbage/cs345/schintro-v14/schintro_toc.html#SEC271 -- cgit v1.2.1