Tag: Compilers
-
Building Your Own Programming Language with LLVM, Rust (Part 4): Control Flow, User-defined Operators, Mutability
This blog post will cover the fifth, sixth, and seventh part of the original LLVM tutorial that was originally written in C++. The next order of business for our model language, Kaleidoscope, is extending it with a variety of features that will allow us to promote it from a basic calculator with JIT compilation into…
-

Building Your Own Programming Language with LLVM, Rust (Part 3): Optimization & Compilation
So far, we have contributed quite a bit of code to this Rust implementation of Kaleidoscope, but have yet to see ourselves compile and run a program in action. All we have so far is a hand-made parser and AST that can then emit some LLVM IR. Nearly one thousand lines of Rust deep, one…
-
Building Your Own Programming Language with LLVM, Rust (Part 2): IR Generation
With the frontend work out of the way, we turn our attention to a new challenge, transforming this funny looking tree structure into something that a processor can understand (using LLVM of course, duh). Although LLVM does not provide any Rust libraries, it does provide header files to invoke in C/C++. Rust was designed to…
-

Building Your Own Programming Language with LLVM–Learning about Compiler Design & LLVM with a Rust Rewrite of the Official LLVM Tutorial (Part 1): Lexer/Parser
Code for this series of posts is found at https://github.com/acolite-d/llvm-tutorial-in-rust-using-inkwell. Recently, during a binge of YouTube and coffee, I stumbled upon a talk by Johnathan Blow, titled “Preventing the Collapse of Civilization.” I’ve known about John through his Twitch streams and one of his earlier video games, Braid, and also his inclination for spouting some…