nowfound

Life & fun · March 20, 2017

How to write a recursive descent parser

How to write a recursive descent parser launched on March 20, 2017 with 347 votes, #48 of 3,481 launches that month and more than 99% of that year's launches. The site was still online in September 2026, 9 years on.

In plain words

This is a chapter from a programming book that teaches readers how to build a recursive descent parser. It is designed for developers who currently use regex and string manipulation to process text but want to learn proper parsing techniques. The chapter covers building parsers with robust error handling, clear internal structure, and the ability to handle complex syntax rules.

written from the facts on this page · September 2026

From the sources

This chapter marks the first major milestone of the book. Many of us have cobbled together a mishmash of regular expressions and substring operations to extract some sense out of a pile of text. The code was probably riddled with bugs and a beast to maintain. Writing a real parser — one with decent error handling, a coherent internal structure, and the ability to robustly chew through a sophisticated syntax — is considered a rare, impressive skill. In this chapter, you will attain it. “Parse” comes to English from the Old French “pars” for “part of speech”. It means to take a text and map each word to the grammar of the language. We use it…from craftinginterpreters.com

Does a similar job

all alternatives →
  • IW
    I Wrote a Book on Java2024 · ▲586

    https://www.manning.com/books/data-oriented-programming-in-j... This book is a distillation of everything I’ve learned about what effective development looks like in Java (so far!). It's about how to organize programs around data "as plain data" and the surprisingly benefits that emerge when we do. Programs that are built around the data they manage tend to be simpler, smaller, and significantly easier understand. Java has changed radically over the last several years. It has picked up all kinds of new language features which support data oriented programming (records,…

  • I'm 17 and wrote a guide on how to build your own programming language2024 · easel.hackclub.com · ▲149

    Hey! I’m JC. I’m 17 and part of Hack Club, a nonprofit where we help teenagers ship programming projects with their friends while growing technically. A while ago, I asked myself the question, “How exactly do programming languages work behind the scenes?” It seemed really daunting until I went to a half hour workshop at a high school hackathon about writing a tree-walk interpreter and realized that getting started was actually super fun. This guide is designed in the vein of that - to get people, especially teenagers, started on learning how to build a programming language in a literal…

  • RegexLearn2021 · regexlearn.com · ▲328

    Learn RegEx step by step, from zero to advanced

  • How to write a tiny compiler2017 · blog.klipse.tech · ▲224

    Write your own compiler: introduction. Code genetation. AST. Abstract syntax tree. lisp. javascript.

  • IW
    I wrote a book on Python regular expressions2019 · ▲193

    My book titled "Python re(gex)?" is free to download through this weekend [1][2] The book covers both 're' and 'regex' modules, has plenty of examples and chapters also have cheatsheets and exercises. Code snippets, exercises, sample chapters, etc are available on GitHub repo [3] I used pandoc+xelatex [4] to generate the pdf. [1] https://gumroad.com/l/py_regex [2] https://leanpub.com/py_regex [3] https://github.com/learnbyexample/py_regular_expressions [4]…

  • Using Parsing Expression Grammars to rewrite source code2016 · github.com · ▲63

    An example of PEG usage. Contribute to sebcat/move-literals development by creating an account on GitHub.

More life & fun this month

the category →

Source: Show HN post ↗

Launched alongside, March 2017

the whole month →
  • A free online program to teach you how to start a company

    Life & fun · 2017 · startupschool.org

  • Neuralink▲890

    Elon Musk's newest company, merging our brain with AI

    AI · 2017 · neuralink.com

  • Illustrated summaries of bestselling nonfiction books

    Life & fun · 2017 · apps.apple.com

  • Canny▲704

    The easiest way to collect & manage feedback

    Growth · 2017 · canny.io

  • Timelines of amazing lives for visual learners

    Work · 2017

  • Breaker▲676

    The social podcast app 🎧

    Life & fun · 2017 · player.fm