Pine Compiler: Statically Typed Language and LLVM-IR Generation

🦾 For the past few months, I’ve been quietly building Pine My own statically typed programming language, from the ground up. It’s one thing to use a language; it’s another to build the compiler that makes it run. It compiles to native binary and runs at near native speed. It successfully compiled a full arithmetic suite—handling functions, stack variables, and multi-parameter logic—lowered it to LLVM-IR, and executed it to return the correct result. The Pine Toolchain (pinec) now handles: Lexical Analysis: Breaking source code into tokens. AST Generation: visualizing the logic tree (exported to .dot files). LLVM-IR Generation: Translating the AST into intermediate representation. Compilation: Building the final binary. Here’s a sample Pine program that now compiles and runs correctly: fn main() -> i32 { let sum: i32 = add(10, 20); let diff: i32 = sub(mul(10, 2, 2), 10); let mul: i32 = mul(1, 2, 3); let div: i32 = div(8, 4); return sum + diff + mul + div; } Output: 68 This is just the beginning. Pine started as a way to truly understand how programming languages work beneath the surface, and it’s now a solid foundation to explore deeper territory—control flow, richer type systems, optimizations, and beyond. Building a compiler changes how you think about code forever, and Pine is my playground for that journey. Excited to keep pushing it forward and see how far it can go 🌲 pine: https://lnkd.in/gpPppbXG #Compilers #ProgrammingLanguages #LLVM #RustLang #SystemsProgramming #LearningInPublic #OpenSource

See more comments

To view or add a comment, sign in

Explore content categories