| #+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. |