Technical Mar 20, 2026
How Vexel Compiles to LLVM IR
When you run vexel run hello.vx, a lot happens before your program executes. Here's the full pipeline.
The Pipeline
- Lexer: tokenizes source text into keywords, identifiers, operators
- Parser: builds an Abstract Syntax Tree (AST) from tokens
- Semantic Analyzer: type-checks, resolves names, validates the program
- LLVM IR Codegen: walks the AST and emits LLVM IR via llvmlite
- LLVM: optimizes and compiles IR to native machine code
From Source to IR
This Vexel function:
fn add(a: int, b: int) -> int:
return a + b Becomes this LLVM IR:
define i64 @add(i64 %a, i64 %b) {
entry:
%result = add i64 %a, %b
ret i64 %result
} You can inspect the IR yourself with vexel ir yourfile.vx.