Matanuska ADR 003 - Recursive Descent Parser
Josh Holbrook

Josh Holbrook @jfhbrook

About: I'm an Alaskan software developer with expertise in data, distributed systems and site reliability.

Location:
Alaska
Joined:
Jan 21, 2019

Matanuska ADR 003 - Recursive Descent Parser

Publish Date: Dec 22 '24
1 0

This article is a repost of an ADR from Matanuska BASIC, my attempt to write a BASIC interpreter in TypeScript.

Context

My initial strategy for parsing was to use parser combinators. In Rust, this was the nom library. In Typescript, this was typescript-parsec.

This strategy is great for hacking up a simple parser. However, I found that it's a relatively inflexible approach, and requires tuning your interface to match the assumptions of the library.

Crafting Interpreters, meanwhile, details how to write recursive descent parsers. These are "hand-rolled", which on its face can require more work. However, the architecture is relatively straightforward to understand and implement, and it's much more flexible.

Decision

Matanuska BASIC will use recursive descent parsers for both its parser and compiler.

Comments 0 total

    Add comment