~swisschili/bluejay

ref: 6d02af472f6ce87ea50ff24aa77f88928dbf31bc bluejay/src/lisp/lisp-notes.org -rw-r--r-- 914 bytes
6d02af47swissChili Add detailed error reporting, remove panics 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#+TITLE: Lisp Notes
#+AUTHOR: swissChili

* Compiler

  The compiler will using DynASM to generate code at runtime. It won’t
  be a JIT (no interpreter), strictly a dynamic compiler.

  For now I won’t even have a register allocator, all variables and
  temporaries will be stored on the stack. This makes more or less
  sense considering they will need to be put on the stack anyway when
  a function is called.

  An example assembly is in =scratch.s=.

  Values will be encoded as double words, where the lowest few bits
  indicate the type.

** Closures and lambdas

   Closures will have to be done in two passes, one pass to find the
   free variables and one to generate the code. Free variables will be
   accessed as an offset to =edi=, which will point to the location of
   the lambda on the heap. =[edi]= will evaluate to the address of the
   lambda, =[edi + 1]= for the first free variable, etc.