Progress on implementing LET, or the need for a macro-expander

So the first real Scheme program that I really want Kiwi to run in TinyCLOS. And just to get started, I’ll need at least let.

I’ve been dragging my feet on nano-expander, so last Sunday, I thought, having read this note from Scheme from Scratch, that I can just do a quick thing inside the existing KiwiNode::compile to transform lets into lambdas.

Typing in the transformation is easy enough, but when I tried to also do let*, it dawned on me that I really do need to have a proper expander – you have to expand all lets to lambdas before compiling, and what I did only worked for the outer-most layer, once I have nested let expressions, the inner lets will already be wrapped inside the outer lambda, without a chance to expand.

So I read up on the next stages of the scope-sets expander and I think I’m gonna merge my nano branch as is, and just proceed to the next micro stage. Once I have micro ported, I can add let and letrec as additional core forms.