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)
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.


Trivial merge