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...
Scheme Compiler in Incremental Steps: Immediate Constants 16 December 2023 In the previous part, we compiled integers and created linker and runtime. In this part, we’ll add few more language features to our compilerCompile Immediate ConstantsIn scheme, we have values other than fixnum integers. We have immediate values ...