Scheme Compiler in Incremental Steps: Heap Allocation 19 December 2023 A lisp is not a lisp if it doesn’t support lists! In this post, let’s implement complicated data structure like lists, strings, etc. These data structures don’t fit in single word like they did for integers, characters and others from our earlier ...
Scheme Compiler in Incremental Steps: Conditional Expressions 18 December 2023 In this post, let’s implement conditional expressions: (if test conseq altern). This is simple to implement at assembly level. We need to employ two labels to transfer control to conseq or altern based on whether test is true. In scheme all values...
Scheme Compiler in Incremental Steps: Local Variables 18 December 2023 In the previous post, we added stack to our implementation of scheme. This allowed us to store intermediate results and therefore binary primitives like (+ a b). Since we now have stack, adding local variables should be straightforward. We will im...
Scheme Compiler in Incremental Steps: Binary Primitives 17 December 2023 In the previous post, we added unary primitives like add1 and null? to our language. In this post, let’s implement binary primitives like +, *, and char<?. We cannot, in general, use a single register because evaluating one argument may overwri...
Scheme Compiler in Incremental Steps: Unary Primitives 16 December 2023 In the previous step, we added immediate constants for integers, characters, booleans and empty list. We now extend the language to include calls to primitives that accept one argument. Let’s start with add1 and sub1 which are increment and decrem...