From: Luke Lau Date: Mon, 3 Jun 2019 14:47:05 +0000 (+0100) Subject: Add LLVM IR codegen X-Git-Url: http://git.lukelau.me/?p=kaleidoscope-hs.git;a=commitdiff_plain;h=de8c7223c79f10c69f9916db1f15b34d20938e2c 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. --- de8c7223c79f10c69f9916db1f15b34d20938e2c