Writing a Compiler in Go
Created on 2020-08-28T23:16:53.235671
Mostly goes over compiling the AST to a custom stack machine. Standard stuff.
- direnv: tool to make it easy to change environment variables dependent on which directory you are in.
- Von Neumann architecture
- Call stack: keeps track of program counters during function calls; needed so when one call ends we know where to return to.
- Symbol table: associates names (the symbol) with information. For example keeps track of which register the value of 'foo' is presently kept in.
Closures
- Closure: a function which carrys a pointer to an environment object.
- Environment: a collection of slots that must persist along with the life of a closure.
- Free variable: a variable which lives outside of a closure yet is touched by it; a reference must be kept in the environment.