Building a Mythological Programming Language Compiler For an x86 CPU (NASM) — Part III — Parser

Creating an Abstract Syntax Tree (AST) From Tokens of a Hyphothethical Yet Working Programming Language

Adrian Nenu 😺
5 min readMar 7, 2024

In the previous two parts we have made baby steps towards building up the capability of parsing code (text) into tokens (a flat array of known entities).

It is high time we converted this flat array into a representation that is closer to the intent of our program. Our program is realistically a tree (see the next diagram, and explanation in my first article), with branching operations, rather than just a block of a text or a flat array of tokens. But these intermediary steps were required for an optimal process of reaching this stage.

If you like this content, please consider clapping, following and subscribing to my newsletter.

Our compiler cooking together an AST — As imagined by Midjourney

Abstract Syntax Tree (AST)

The AST will be a more picture-perfect representation of the intent of our code. This is because it will…



Adrian Nenu 😺

Software Engineer @ Google. Photographer and writer on engineering, personal reflection, and creativity -