Matanuska ADR 003 – Recursive Descent Parser
December 22, 2024

Matanuska ADR 003 – Recursive Descent Parser

This article is reproduced from ADR Matanuska BasicsI tried to write a BASIC interpreter using TypeScript.


context

My initial parsing strategy was to use a parser combinator. In Rust, this is nom library. In Typescript, this is typescript-parsec.

This strategy is great for hacking a simple parser. However, I find this to be a relatively inflexible approach and requires adjusting your interface to match the library’s assumptions.

Crafting InterpretersAlso, details on how to write a recursive descent parser. These are “hand rolled” and may look like they require more work. However, the architecture is relatively easy to understand and implement, and a lot of More flexible.


Decide

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

2024-12-22 14:57:00

Leave a Reply

Your email address will not be published. Required fields are marked *