Building a Compiler in Swift with LLVM, Part 3: Code Generation to LLVM IR

If you’ve gotten this far in the tutorial, then you’ll have built a Lexer and Parser for the Kaleidoscope programming language. If you haven’t read those, I’d strongly recommend reading Part 1 and Part 2 first. This time we’ll be turning this parser into a proper compiler by turning the parsed code into LLVM Intermediate Representation (LLVM IR).

Read this article

Building a Compiler in Swift with LLVM, Part 2: AST and the Parser

In Part 1 of this tutorial, we built a lexer in Swift that can tokenize the Kaleidoscope language. Now we’re going to write a parser that can turn code from this language into an Abstract Syntax Tree, or AST.

Read this article

Building a Compiler in Swift with LLVM, Part 1: Introduction and the Lexer

Compilers are some of the most fascinating programs because they touch every aspect of Computer Science, from CLI and API design to calling conventions and platform-specific optimizations. Yet, many developers have a fearful reverence for them that makes them seem unapproachable. I think this is unnecessary.

Read this article