Writing a compiler

I’ve started a project on writing a Lisp-like compiler from scratch. Currently got a full working data-form parser (so now I can parse any Lisp program into an abstract syntax tree), it’s memory safe and all written in C++ (no yacc/lexx/etc).

However, I’m having a a problem with writing the rest of it. That is, the actual language interpreter itself. I think I might need to read some books on this part; the lexer and parser were just neat programming problems on simple data parsing and basic recursive descent, but an evaluator is an implementation of the actual logic of the language.

According to The Dragon Book I’m at chapter 6~ roughly, where I’ve written a front-end which can interpret raw text into an AST and now need a way to translate that into machine code.

This is the domain of static analysis and code generation.

I’ll need to write systems for each one and apply it to the AST, producing errors when necessary.