diff options
Diffstat (limited to 'README.md')
-rwxr-xr-x | README.md | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100755 index 0000000..4caf1c3 --- /dev/null +++ b/README.md | |||
@@ -0,0 +1,53 @@ | |||
1 | # Bad Diode's Lisp | ||
2 | |||
3 | For some time I've been meaning to learn more about compilers and programming | ||
4 | language theory. And so I found myself again delving into a rabbit hole of | ||
5 | wheel-reinvention for the purpose of fun and learning. | ||
6 | |||
7 | The goals for this project are to build a programming language that can be | ||
8 | interpreted directly from a VM and with support for compilation to assembly | ||
9 | (`x86_64` and/or `ARM (thumb or aarch64)`). It could make sense to output | ||
10 | bytecode for LLVM to take advantage of the built in optimizations, but let's | ||
11 | just go one step at a time. At the time I know some ARM assembly, but I'm not so | ||
12 | versed in `x86_64` and know nothing of LLVM bytecode. | ||
13 | |||
14 | I've chosen to implement a Lisp, perhaps a subset of Scheme. The syntax is not | ||
15 | so important for now, maybe in the future the compiler will take a different | ||
16 | home-brew language, but hopefully this helps setting the fundamentals for | ||
17 | a minimal working compiler. In principle, we could keep the internal | ||
18 | representation and language working as a lisp, but with a different external | ||
19 | syntax. | ||
20 | |||
21 | The language should have built-in structures for dynamic arrays, hash tables, | ||
22 | strings (and string views). It should be suitable for use in embedded systems | ||
23 | and be linked seamlessly with other compiled objects. | ||
24 | |||
25 | Accessing system resources, such as stdio or graphics could be done via function | ||
26 | calls to the give APIs. This should help decouple the CPU logic from hardware, | ||
27 | hopefully facilitating porting programs to different platforms (GBA, Rasberry | ||
28 | Pi, etc.). | ||
29 | |||
30 | The current plan is to build a bootstrap interpreter in C that can be used to | ||
31 | generate the self-hosted version of itself. I'll try to document the process | ||
32 | here as best as I can. | ||
33 | |||
34 | The bootstrap implementation should be kept simple, since we can focus on | ||
35 | optimization once we have a self-hosting compiler. | ||
36 | |||
37 | # Resources | ||
38 | |||
39 | - [Structure and Interpretation of Computer Programs][sicp] | ||
40 | - [Crafting Interpreters][crafting-interpreters] | ||
41 | - [Building a Scheme from scratch][scheme-from-scratch] | ||
42 | - [Compiling a Lisp][compiling-a-lisp] | ||
43 | - [An Incremental Approach to Compiler Construction][ghuloum11] | ||
44 | - [Make-A-Lisp Guide][mal] | ||
45 | - [An Introduction to Scheme and its Implementation][intro-to-scheme-and-imp] | ||
46 | |||
47 | [sicp]: https://mitpress.mit.edu/sites/default/files/sicp/index.html | ||
48 | [crafting-interpreters]: https://craftinginterpreters.com/ | ||
49 | [scheme-from-scratch]: http://peter.michaux.ca/articles/scheme-from-scratch-introduction | ||
50 | [compiling-a-lisp]: https://bernsteinbear.com/blog/compiling-a-lisp-0/ | ||
51 | [ghuloum11]: http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf | ||
52 | [mal]: https://github.com/kanaka/mal/blob/master/process/guide.md | ||
53 | [intro-to-scheme-and-imp]: https://www.cs.utexas.edu/ftp/garbage/cs345/schintro-v14/schintro_toc.html#SEC271 | ||