<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Gideon Towolawi </title>
    <description>The latest articles on Forem by Gideon Towolawi  (@ayndlr).</description>
    <link>https://forem.com/ayndlr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3936747%2Fcd705d82-db87-484f-ace1-091badc66800.png</url>
      <title>Forem: Gideon Towolawi </title>
      <link>https://forem.com/ayndlr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ayndlr"/>
    <language>en</language>
    <item>
      <title>The Compiler Maze</title>
      <dc:creator>Gideon Towolawi </dc:creator>
      <pubDate>Sun, 24 May 2026 18:57:16 +0000</pubDate>
      <link>https://forem.com/ayndlr/the-compiler-maze-4clp</link>
      <guid>https://forem.com/ayndlr/the-compiler-maze-4clp</guid>
      <description>&lt;h2&gt;
  
  
  Why Compiler is a very breathtaking project for devs and single dev
&lt;/h2&gt;

&lt;p&gt;I just got into the parser stage 2 days ago and the design was flowing like a breeze. Since my &lt;strong&gt;compiler&lt;/strong&gt; is focused as a &lt;strong&gt;system programming&lt;/strong&gt; compiler for my custom language, I was at the type checking (local type checking) phase.&lt;/p&gt;

&lt;p&gt;This is where I created a util.hpp file in which I wrote a namespace containing polymorphic code as it is a global type system my compiler will use to verify type at compile time.&lt;/p&gt;

&lt;p&gt;My compiler makes sure it does everything at compile time as it really benefits — creating a custom language means you're definitely tired of the scope of the current language compiler, so that's why we're here!&lt;/p&gt;

&lt;h3&gt;
  
  
  Type System
&lt;/h3&gt;

&lt;p&gt;The compiler tries to be ambitious like Zig and more than it, as it supports variable width types from 1 to 65535 for both unsigned and signed. I won't lie, I learned the formula for signed and unsigned, but like I said, the compiler scope got in my way: how do I store 2^65535 - 1 for unsigned value range? As we famous graphics devs and codecs know, u8 is from 0 to 255. Wait, it's unrelated.&lt;/p&gt;

&lt;h3&gt;
  
  
  My Ambitions
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcoderlegion.com%2F%3Fqa%3Dblob%26qa_blobid%3D5719992594881900651" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcoderlegion.com%2F%3Fqa%3Dblob%26qa_blobid%3D5719992594881900651" width="600" height="900"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm a rising video codec engineer but no traditional DCT, motion vector in my vision. I did try to invent a proprietary upscaler called &lt;strong&gt;GVEST&lt;/strong&gt; (Geometry Vector Expansion Spatial Transform). It's better than bilinear by a few tens of dB in edge construction without blurring, and same dB on a noisy image. If you want to see the images, I will try to upload the graph and simulation results which AI did run Python code to generate, in another Non-Compiler Series of ours. So to cut the story short, I knew entropy coding and video codecs need not just runtime precision but memory precision. And don't get me wrong — Gemini AI helped me fix the formula, as fitting the above range results from the above formula is not my path and I didn't see it coming, and I don't want another hour of burnout. I want to add theoretical bit-size memory allocation to the value of that variable bits to memory, meaning if a u8 (which is 1 byte) and the value was 5 which doesn't take the whole 8 bits or byte, why waste memory? But it's non-trivial as unpacking them will be a big fight, but I'm still going that route.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's still breathtaking
&lt;/h3&gt;

&lt;p&gt;Won't lie — I'm very ambitious. I've got so much type system, DSA to optimize at compile time. I asked AI why no language optimizes tree-based &lt;strong&gt;DSA&lt;/strong&gt; as I knew little about them. All my life from JS to C++ wasn't more than structs and arrays (with vector in C++'s case). I did learn DSA in my days as a JS dev, but C++ is different in everything: containers abstraction, STL, iterators, the &lt;code&gt;.data() + index&lt;/code&gt;, end or the &lt;code&gt;.begin()&lt;/code&gt;, &lt;code&gt;.end()&lt;/code&gt; — it's everywhere in C++, and beginners and experienced devs definitely still go to the docs once in a while. And honestly, the docs aren't great too.&lt;/p&gt;

&lt;p&gt;I went through serious burnout today as I want my language, even if C++-like, to have ownership and lifetime and memory validation, if you've seen my ambition above. It will also be friendly and clear with error messages, and I'm already proud of my lexer stage error messages on my string and char warnings and recovery on unterminated literals. It's really a breathtaking journey.&lt;/p&gt;

&lt;h3&gt;
  
  
  Closing it all up
&lt;/h3&gt;

&lt;p&gt;If you liked the architecture and insights you've seen or haven't, I welcome you in the comments section, and if you want to subscribe to my Newsletter — though it's in early stage — become my subscriber on Substack: &lt;a href="https://ayndlr.substack.com" rel="noopener noreferrer"&gt;Substack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm happy building the project as I'm not looking at where I am but where it's going to be. I'm breaking the LLVM oath solo, and you can too. If you follow up, everything counts for me.&lt;/p&gt;

</description>
      <category>devjournal</category>
      <category>cpp</category>
      <category>systemdesign</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Why These and That in Every System</title>
      <dc:creator>Gideon Towolawi </dc:creator>
      <pubDate>Sun, 24 May 2026 13:20:17 +0000</pubDate>
      <link>https://forem.com/ayndlr/why-these-and-that-in-every-system-17io</link>
      <guid>https://forem.com/ayndlr/why-these-and-that-in-every-system-17io</guid>
      <description>&lt;p&gt;We all know about DSA—Data Structures and Algorithms. But that's not all there is to programming, no matter the field. I emphasize this especially in software engineering: DSA is almost never the fix on its own.&lt;/p&gt;

&lt;p&gt;Today marks over a week and a half on my lexer since the beginning of May 2026, when I decided to build a compiler. I've gone through different choices, code patterns, rewrites. But you know what? I didn't read a single compiler book. No Compiler Dragon Book—the bible of the field. No PDF, no 2,000 pages just to experience someone else's experience into yours.&lt;/p&gt;

&lt;p&gt;This article isn't saying you shouldn't read books. But if you're a systems engineer like me—and my experience is pretty low, roughly 2.5 years in C++ and years in programming—we know tools aren't always the answer. In fact, DSA isn't either. This isn't about toy projects. We're talking about real production-grade projects where every performance detail and line of code must be understood perfectly, not just written pretty.&lt;/p&gt;

&lt;p&gt;While writing the lexer in C++, coming from Rust after ditching C++ for a while, I hated my comeback. Rust's ownership model and the compiler fighting me on every borrow? I ran from it. Went back to C++ where debugging a struct—which was my token object—meant just printing fields and moving on. No lifetime elision wars, no fighting the borrow checker because my token held a reference to source text that might outlive the lexer stream. In C++, I own my memory, I leak it, I fix it. The cost is visible immediately. In Rust, the cost was hidden behind compiler errors that were technically correct but solved someone else's problem, not mine. I didn't need zero-cost abstractions. I needed to see my token struct in a debugger without wrestling with the language first.&lt;/p&gt;

&lt;p&gt;Those questions turned out to be simple. Deceptively so.&lt;/p&gt;

&lt;p&gt;I noticed that while having only the basics of compilers—its stages, just the prior experience (in my case: Lexer → AST → IR → Codegen)—if I had actually asked the same questions as the first person who attempted it, about its architecture, what it solves, and the coding reality... because as we all know, design doesn't map well to code. In the worst case, if we try to find the ratio, we can use only the most abstract and subtle design—not overly architected, but rearchitected through code. This is a classic system design phase, but I realized it through grit.&lt;/p&gt;

&lt;p&gt;So the problem, which you've probably guessed, is we want to solve two problems. First: no manual assembly. Second: high-level code and its own problem—which is, how do they get back to their root?&lt;/p&gt;

&lt;p&gt;The best approach—not the only approach, but the best—was to use what we all call a lexer today: a stream-broken, tokenized, labeled source code.&lt;/p&gt;

&lt;p&gt;But why? Why not parse straight from the character stream? Why add a whole stage just to label things?&lt;/p&gt;

&lt;p&gt;Because the problem isn't "how do I read code." The problem is how do I transform high-level intent into machine execution without writing machine code by hand. And that problem has two parts: the human writes symbols, the machine needs instructions. The gap between them is where every cost hides.&lt;/p&gt;

&lt;p&gt;So you ask the two questions. First: what do I actually need to know about this source? Not "what data structure should I use"—that's the DSA trap. You don't reach for a hash map because hash maps are fast. You reach for it when your problem is "I need to check if I've seen this identifier before in O(1)." The problem first. The structure second.&lt;/p&gt;

&lt;p&gt;Second: where does the cost arrive? Design won't show you. Design is clean boxes and arrows. Code reveals it. When I wrote my lexer, I didn't hit the cost in the diagram. I hit it when I realized a recursive descent parser trying to backtrack over raw character streams was burning CPU on re-lexing the same identifier five times. The cost wasn't visible in the "Lexer → Parser" box. It was visible in the profiler, in the branching, in the cache misses from string comparisons.&lt;/p&gt;

&lt;p&gt;That's when the engineering choice crystallized. The lexer isn't there because compilers "should have one." It's there because tokenization is the point where you pay the string cost once, then never again. You transform the variable-length, unpredictable, cache-unfriendly character soup into fixed-size, predictable, cache-friendly labels. That's not a fancy design pattern. That's solving the first sub-problem: how do I make the rest of the pipeline fast enough to be usable?&lt;/p&gt;

&lt;p&gt;Now, why can't the parser live in the lexer? Why not just build the AST while tokenizing?&lt;/p&gt;

&lt;p&gt;Because the lexer solves a linear problem. It walks left-to-right, one pass, no memory of nesting depth. The parser solves a non-linear problem. Take a complex recursive function—nested lambdas, match arms, closures capturing environments. The lexer sees this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FN  IDENT  LPAREN  IDENT  COLON  IDENT  RPAREN  LBRACE  MATCH  IDENT  LBRACE...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Flat. Stateless. A conveyor belt of labels. It has no stack to track "this brace closes the lambda, not the match arm." It cannot, by design, handle recursion because recursion requires a tree, and trees require a builder that remembers where it is in the structure.&lt;/p&gt;

&lt;p&gt;The parser sees the same tokens, but at depth 3, inside a match arm, inside a closure, knowing exactly which brace closes which scope. The lexer sees &lt;code&gt;RBRACE&lt;/code&gt; and thinks "end of something." The parser knows "end of match arm, inside lambda, inside function." That's the difference between a label and a structure.&lt;/p&gt;

&lt;p&gt;Could you force the lexer to track a stack? Could you make it "smart"? Sure. Now you've merged two problems into one stage. And when that recursive function nests ten levels deep, your lexer isn't tokenizing anymore—it's predicting, it's branching, it's holding state that grows with input complexity. The cost arrives in CPU exhaustion, in stack overflows, in the maze of entry and exit points where you can't tell if you consumed the full path or just the happy path. Burnout in code, not in design.&lt;/p&gt;

&lt;p&gt;And here's what they don't tell you: the burnout hits the engineer before it hits the machine. The junior who reads three compiler books before writing a line of code. The team that designs for 1M users at 100 users. The developer who builds a distributed system because "microservices are best practice" when a monolith would have shipped in a week. The cost arrives in the human first—in the paralysis of premature abstraction, in the exhaustion of solving problems you don't have yet. That's why these stages exist. Not because a book prescribed them. Because that problem needed that solution.&lt;/p&gt;

&lt;p&gt;The AST exists because some problems are inherently non-linear, and pretending they're linear doesn't make them linear—it makes them expensive. The parser is where you accept that cost upfront, where you build the explicit tree, where you make recursion manageable by giving it a structure that matches its nature. The AST isn't standard because every language has different non-linear truths. SIRL's match arms with explicit types need different nodes than C's switch statements. The AST shape is dictated by what your language actually does, not by what some book says it should look like.&lt;/p&gt;

&lt;p&gt;Same for the IR. Same for the lexer. We know the stages—Lexer → Parser → AST → IR → Codegen—but the implementations diverge because the problems diverge. A JIT compiler skips the AST for hot paths because its problem is latency, not optimization. An embedded compiler uses a different IR because its problem is register pressure, not vectorization.&lt;/p&gt;

&lt;p&gt;This is the grit. The design phase gives you the illusion that you've solved it. The code phase reveals you haven't. Design doesn't map to code. It maps to intention. Code maps to reality. And reality is where the cost lives—in the branching, in the memory layout, in the cache lines, in the non-linear paths that design documents politely ignore.&lt;/p&gt;

&lt;p&gt;Books give you answers to questions you don't have yet. The problem is yours; the answer should be too. Not from blind DSA application. Not from following a chapter. From asking what you actually need to know, and having the guts to let the code show you where the cost lives.&lt;/p&gt;

&lt;p&gt;So the lexer stays dumb. The parser stays recursive. The AST stays language-specific. Not because it's elegant. Because each stage solves exactly one problem, pays exactly one cost, and exposes exactly one interface to the next stage. That's systems engineering. Not DSA for DSA's sake. Problem first. Cost second. Structure last.&lt;/p&gt;

&lt;p&gt;And when you finally lower to IR and codegen to assembly, you've answered both original problems. No manual ASM. High-level code returned to its roots. But the path there wasn't found in a book. It was found by asking what the problem actually is, where the cost actually arrives, and having the grit to let code—not design, not someone else's experience—tell you the truth.&lt;/p&gt;

&lt;p&gt;Two questions. Everything else is just typing.&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>devjournal</category>
      <category>softwareengineering</category>
      <category>systems</category>
    </item>
    <item>
      <title>The Compiler: Heart and Tools of All Software</title>
      <dc:creator>Gideon Towolawi </dc:creator>
      <pubDate>Mon, 18 May 2026 16:36:00 +0000</pubDate>
      <link>https://forem.com/ayndlr/the-compiler-heart-and-tools-of-all-software-5gl8</link>
      <guid>https://forem.com/ayndlr/the-compiler-heart-and-tools-of-all-software-5gl8</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm6hyu9w59a4oat024w7a.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm6hyu9w59a4oat024w7a.jpg" alt="Ayn Dlr System Engineer" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Compiler: Heart and Tools of All Software
&lt;/h2&gt;

&lt;p&gt;Every program you have ever run — your operating system, your browser, the app that woke you up this morning, the firmware in your coffee machine — was once just text. Human-readable text. Ideas typed by someone who understood a problem well enough to describe its solution.&lt;/p&gt;

&lt;p&gt;But computers do not read ideas. They read instructions. Binary. Electrical signals that mean nothing without precise interpretation.&lt;/p&gt;

&lt;p&gt;The bridge between human intention and machine execution is the &lt;strong&gt;compiler&lt;/strong&gt;. It is the most consequential piece of software ever invented. Without it, computer science as we know it does not exist.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Computer Science Would Be Without Compilers
&lt;/h2&gt;

&lt;p&gt;Imagine a world where every programmer writes raw machine code. Not assembly — actual binary. Opcodes and operands encoded by hand. Every program is a miracle of patience, and every bug is a nightmare of hexadecimal archaeology.&lt;/p&gt;

&lt;p&gt;In this world:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Software development is artisanal&lt;/strong&gt;, not industrial. A single application takes years.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Portability is a myth&lt;/strong&gt;. Every CPU architecture requires rewriting everything from scratch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Abstraction dies&lt;/strong&gt;. There are no functions, no types, no modules — just raw memory and jumps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security is impossible&lt;/strong&gt;. Human minds cannot track the state of thousands of registers and memory locations simultaneously.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Computer science without compilers is not computer science. It is digital craftsmanship at the limit of human endurance. The compiler is what lets us think in &lt;strong&gt;concepts&lt;/strong&gt; instead of &lt;strong&gt;circuits&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Compiler as a Pipeline of Principles
&lt;/h2&gt;

&lt;p&gt;A compiler is not a single program. It is a &lt;strong&gt;pipeline of transformations&lt;/strong&gt;, each stage reducing complexity and increasing structure. The quality of a compiler depends entirely on the &lt;strong&gt;principles&lt;/strong&gt; baked into each stage.&lt;/p&gt;

&lt;p&gt;Most people know the classical stages:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Lexer&lt;/strong&gt; — characters → tokens&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parser&lt;/strong&gt; — tokens → syntax tree&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic Analysis&lt;/strong&gt; — syntax tree → validated intermediate representation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimization&lt;/strong&gt; — IR → faster IR&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Generation&lt;/strong&gt; — IR → machine code&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;But this description misses the point. The stages are not just mechanical steps. They are &lt;strong&gt;guardians of meaning&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stage 1: The Lexer — Dumb by Design
&lt;/h3&gt;

&lt;p&gt;The lexer is where principles begin. Its job is simple: convert a stream of characters into a stream of tokens. &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;=&lt;/code&gt;, &lt;code&gt;42&lt;/code&gt;, &lt;code&gt;;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A bad lexer tries to be smart. It merges &lt;code&gt;=&lt;/code&gt; &lt;code&gt;=&lt;/code&gt; into &lt;code&gt;==&lt;/code&gt;. It strips whitespace because "it doesn't matter." It reconstructs strings and throws away the original quotes.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;principled lexer stays dumb&lt;/strong&gt;. It emits raw tokens with precise spatial information — where each token starts, where it ends, what line, what column. It does not interpret. It does not merge. It does not discard.&lt;/p&gt;

&lt;p&gt;Why? Because &lt;strong&gt;semantics belong to the parser&lt;/strong&gt;. The lexer cannot know whether &lt;code&gt;::&lt;/code&gt; is a scope resolution operator or two separate colons in a ternary expression. It cannot know whether whitespace inside a string literal is significant or decorative. By staying dumb, the lexer preserves &lt;strong&gt;all information&lt;/strong&gt; for downstream stages to make informed decisions.&lt;/p&gt;

&lt;p&gt;The token structure I use reflects this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nc"&gt;Token&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;TokenType&lt;/span&gt; &lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;      &lt;span class="c1"&gt;// what kind of token&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;lexeme&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// the raw text&lt;/span&gt;
  &lt;span class="kt"&gt;size_t&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;         &lt;span class="c1"&gt;// visual line for errors&lt;/span&gt;
  &lt;span class="kt"&gt;size_t&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;       &lt;span class="c1"&gt;// visual column for errors&lt;/span&gt;
  &lt;span class="kt"&gt;size_t&lt;/span&gt; &lt;span class="n"&gt;span_to&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;      &lt;span class="c1"&gt;// exclusive byte offset in source&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;span_to&lt;/code&gt; is the critical field. It lets the parser reconstruct multi-token operators. It lets the formatter preserve original spacing. It lets the LSP highlight exact ranges. The lexer does not use this information — it merely &lt;strong&gt;records&lt;/strong&gt; it, faithfully and without interpretation.&lt;/p&gt;

&lt;p&gt;This is the first principle: &lt;strong&gt;reduce at the right stage, never earlier&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Principles Matter More Than Performance
&lt;/h3&gt;

&lt;p&gt;It is tempting to optimize the lexer. Merge tokens early. Strip separators. Compress the token stream. These optimizations feel productive.&lt;/p&gt;

&lt;p&gt;They are traps.&lt;/p&gt;

&lt;p&gt;Every piece of information discarded in the lexer is a piece of information that cannot be recovered in the parser, the semantic analyzer, or the code generator. A stripped space cannot be restored for formatting. A merged &lt;code&gt;==&lt;/code&gt; cannot be split back if the parser needs to report "unexpected token &lt;code&gt;=&lt;/code&gt; after &lt;code&gt;=&lt;/code&gt;". An interpreted string literal loses the original escape sequences.&lt;/p&gt;

&lt;p&gt;The cost of a "smart" lexer is &lt;strong&gt;permanent information loss&lt;/strong&gt;. The cost of a dumb lexer is a slightly larger token stream — trivial to optimize later, impossible to reconstruct if deleted early.&lt;/p&gt;

&lt;p&gt;This principle extends through every compiler stage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Parser&lt;/strong&gt;: Validate syntax strictly, but do not constant-fold yet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic Graph&lt;/strong&gt;: Resolve types and ownership, but do not lower to machine concepts yet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IR&lt;/strong&gt;: Represent semantics faithfully, optimize only when correctness is provable&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend&lt;/strong&gt;: Generate code for the target, but never modify semantic truth&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each stage has one job. Each stage does that job completely. No stage does another stage's work prematurely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building Correct by Construction
&lt;/h2&gt;

&lt;p&gt;The compiler is not just a tool. It is a &lt;strong&gt;proof system&lt;/strong&gt;. It proves that your program means what you think it means, that it will not leak memory, that it will not access invalid lifetimes, that it will execute deterministically across architectures.&lt;/p&gt;

&lt;p&gt;This is not about being clever. It is about being &lt;strong&gt;correct by construction&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Comes Next
&lt;/h2&gt;

&lt;p&gt;Over the next weeks, I will document each stage of compiler construction in detail:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why the lexer stays dumb and what that enables&lt;/li&gt;
&lt;li&gt;How the semantic graph builds structure from raw tokens&lt;/li&gt;
&lt;li&gt;What compile-time invariants mean for systems programming&lt;/li&gt;
&lt;li&gt;How to translate semantics into machine resources without losing correctness&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are building compilers, thinking about language design, or simply curious about how software becomes real, &lt;a href="https://ayndlr.substack.com" rel="noopener noreferrer"&gt;subscribe to the newsletter&lt;/a&gt;. I share what I learn, what I get wrong, and how to avoid the traps I fall into.&lt;/p&gt;

&lt;p&gt;The compiler is the heart of software. Understanding it is understanding how we turn thought into action.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Building a systems language that writes like C++ and proves safety like Rust, without the mental overhead. &lt;a href="https://ayndlr.substack.com" rel="noopener noreferrer"&gt;Join the newsletter&lt;/a&gt; for weekly deep-dives on compiler architecture, language design, and systems programming.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>compilers</category>
      <category>programming</category>
      <category>systems</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>I'm Building a Multi-Target Compiler Backend from Scratch — No LLVM, No Crutches</title>
      <dc:creator>Gideon Towolawi </dc:creator>
      <pubDate>Sun, 17 May 2026 20:49:04 +0000</pubDate>
      <link>https://forem.com/ayndlr/im-building-a-multi-target-compiler-backend-from-scratch-no-llvm-no-crutches-57be</link>
      <guid>https://forem.com/ayndlr/im-building-a-multi-target-compiler-backend-from-scratch-no-llvm-no-crutches-57be</guid>
      <description>&lt;p&gt;Hi there, i'm Gideon. Roughly 1.5 years of writing C++ from the ground up — ray tracers, video codecs, and now a compiler. No frameworks. No LLVM. Just me, the hardware manuals, and a lot of wrong turns.&lt;/p&gt;

&lt;p&gt;This post starts a series where I document the build in real time. I'm currently in the parser stage. By the end, I want a compiler that emits x86-64 and SPIR-V from a C++-like language, with SIMD vectorization and security-hardened codegen baked in.&lt;/p&gt;

&lt;p&gt;What I'm Actually Building&lt;/p&gt;

&lt;p&gt;Not a programming language. A compiler backend toolkit — the part that turns intermediate representation into fast machine code across multiple targets.&lt;/p&gt;

&lt;p&gt;The pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Source → Parser → AST → SSMOL (HIR) → MREL (LIR) → x86-64 / SPIR-V / ARM64 / RISC-V / WASM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;MREL is my target-agnostic low-level IR. It knows about virtual registers, stack slots, and machine operations — but not physical register names. The backend handles that per-target.&lt;/p&gt;

&lt;p&gt;Why Not Just Use LLVM?&lt;/p&gt;

&lt;p&gt;LLVM is 4 million lines of code. It solves everyone's problem and no one's perfectly. I need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fine-grained control over SIMD width selection per target&lt;/li&gt;
&lt;li&gt;Constant-time crypto primitive emission with secret register annotations&lt;/li&gt;
&lt;li&gt;Security obfuscation passes (control flow flattening, opaque predicates)&lt;/li&gt;
&lt;li&gt;A codebase I fully understand and can license&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Building from scratch is slower. But I own every decision.&lt;/p&gt;

&lt;p&gt;Where I Am Right Now&lt;/p&gt;

&lt;p&gt;Parser stage. Hand-written recursive descent. C++-like syntax with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Functions, structs, basic types&lt;/li&gt;
&lt;li&gt;Ownership semantics (borrowed from my Rust phase, simplified)&lt;/li&gt;
&lt;li&gt;Explicit SIMD types (&lt;code&gt;v128&lt;/code&gt;, &lt;code&gt;v256&lt;/code&gt;, &lt;code&gt;v512&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The parser emits an AST that gets lowered to SSMOL — my high-level IR that knows about types, ownership, and semantics.&lt;/p&gt;

&lt;p&gt;What's Next&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;SSMOL → MREL lowering (types to sizes, structs to offsets, control flow to basic blocks)&lt;/li&gt;
&lt;li&gt;MREL → x86-64 backend (register allocation, instruction selection, ELF emission)&lt;/li&gt;
&lt;li&gt;One working program: compile, link, run &lt;code&gt;main()&lt;/code&gt; that returns 42&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then SPIR-V compute kernels. Then the rest.&lt;/p&gt;

&lt;p&gt;What I'll Write About&lt;/p&gt;

&lt;p&gt;Each stage, when I hit it. The problems that took me three days to solve. The specs I wrote to keep myself honest. The wrong assumptions that cost me a week.&lt;/p&gt;

&lt;p&gt;Not polished tutorials. Build logs from someone actually building.&lt;/p&gt;

&lt;p&gt;Follow This Series If&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You work in systems, compilers, or graphics&lt;/li&gt;
&lt;li&gt;You're curious what "building from scratch" actually looks like&lt;/li&gt;
&lt;li&gt;You want to see if I crash or ship&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Substack: (&lt;a href="https://ayndlr.substack.com" rel="noopener noreferrer"&gt;https://ayndlr.substack.com&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Closing&lt;/p&gt;

&lt;p&gt;This is post 1 of however many it takes. Next post: parsing expressions with operator precedence and why I gave up on Pratt parsing.&lt;/p&gt;

&lt;p&gt;Follow for the crash or the ship. Either way, it's real.&lt;/p&gt;

</description>
      <category>compilers</category>
      <category>systems</category>
      <category>backend</category>
      <category>simd</category>
    </item>
  </channel>
</rss>
