Posts

Understanding the Go compiler: The Parser

Understanding the Go compiler: The Parser

In the previous blog post, we explored the scanner—the component that converts your source code from a stream of characters into a stream of tokens.

Now we’re ready for the next step: the parser.

Here’s the challenge the parser solves: right now, we have a flat list of tokens with no relationships between them. The scanner gave us package, main, {, fmt, ., Println… but it has no idea that Println belongs to the fmt package, or that the entire fmt.Println("Hello world") statement lives inside the main function.

A SQL Query's Roadtrip Through Postgres

A SQL Query's Roadtrip Through Postgres

Ever wonder what happens when you type SELECT * FROM users WHERE id = 42; and hit Enter? That simple query triggers a fascinating journey through PostgreSQL’s internals—a complex series of operations involving multiple processes, sophisticated memory management, and decades of optimization research.

This is the first article in a series where we’ll explore PostgreSQL’s query execution in depth. In this overview, I’ll walk you through the complete journey from SQL text to results, giving you the roadmap. Then, in subsequent articles, we’ll dive deep into each component—the parser, analyzer, rewriter, planner, and executor—exploring the details of how each one works.

Understanding the Go compiler: The Scanner

Understanding the Go compiler: The Scanner

This is part of a series where I’ll walk you through the entire Go compiler, covering each phase from source code to executable. If you’ve ever wondered what happens when you run go build, you’re in the right place.

Note: This article is based on Go 1.25.3. The compiler internals may change in future versions, but the core concepts will likely remain the same.

I’m going to use the simplest example possible to guide us through the process—a classic “hello world” program:

Welcome to Internals for Interns

Welcome to Internals for Interns

Welcome! I’m thrilled to finally launch this project—something I’ve been thinking about for almost a decade.

What This Is All About

For over 10 years, I’ve been giving talks at conferences about how things work under the hood. I started in the Python community, exploring topics like the object model, garbage collection, and the CPython interpreter internals. Later, I expanded into other communities—Go, PostgreSQL, and beyond—always with the same goal: making complex internals approachable.