</s>Add LLVM IR codegen
authorLuke Lau <luke_lau@icloud.com>
Mon, 3 Jun 2019 14:47:05 +0000 (15:47 +0100)
committerLuke Lau <luke_lau@icloud.com>
Mon, 3 Jun 2019 23:11:03 +0000 (00:11 +0100)
commit8c8af9bee8528de4d02be18123a953a95d35c037
treeab091fa4056e0080df5df5473156e2e53b7dc7ce
parentde13c09fc0daba34cdc823aff1f2ca95b683f5e0
</s>Add LLVM IR codegen

Now that we have our AST built up, its time to start thinking about
semantics. And to think about semantics, we need to start building up
code that does what our AST says.

In most compilers, we don't directly convert the AST right down to
machine code: Usually there's an intermediate representation involved
that's somewhere between our programming language and machine code. LLVM
has an intermediate representation called LLVM IR, and that's what we'll
be converting our AST to.

llvm-hs provides a monadic way of building up modules and functions,
with ModuleBuilder and IRBuilder respectively. To generate our code we
will traverse our AST inside these monads, spitting out LLVM IR as we go
along.