Parsers don't have to be complicated

Coder says parsing can be simple, commenters immediately start a line-ending war

TLDR: A developer built a small, readable tool for parsing text without the usual complexity or giant code generators. Commenters instantly split between “finally, keep it simple” and “good luck when real-world broken input shows up,” with bonus drama over Windows-style line endings.

A programmer showed off a tiny new text-reading tool meant to live in the sweet spot between messy hand-written code and giant auto-generated systems. The pitch is simple: no bloat, no mystery machinery, no copying text around, and fewer chances to trip over the same annoying bugs every time you need to read a file or command. In plain English, it’s a small reusable helper for reading text cleanly instead of reinventing the wheel badly over and over again.

But the real fireworks were in the comments, where readers treated “simple” like a personal challenge. One camp basically said, cute idea, but this is nowhere near the hard stuff. A commenter mocked it as only “20%” of the journey from chaotic string-wrangling to elegant parser heaven, while another rolled in with a classic internet reality check: try a gnarly IPv6 web address and watch “simple” evaporate. Meanwhile, someone else turned the whole thing into a mini culture war over weird carriage returns, asking if trimming stray \r is practical cleanup or just a sneaky jab at Windows line endings.

And because no developer thread is complete without tool evangelism, one reader arrived like a door-to-door missionary for nom, insisting parsing becomes a fun puzzle once you learn it. The most grounded take? Parsing isn’t hard because of code — it’s hard because humans keep feeding computers cursed input. In other words: the tool may be simple, but the internet absolutely is not.

Key Points

  • The article contrasts parser generators like Lemon with repeated ad-hoc parsing code and presents both as unsatisfactory for the author's needs.
  • Ad-hoc parsers are described as fast and dependency-free but prone to repeating low-level scanning logic and one-off bugs.
  • bx::Scanner is introduced as a small reusable scanning utility rather than a parser generator or PEG library.
  • Its design includes zero-copy StringView-based results, explicit cursor movement, built-in one-based line and column tracking, and simple character classes with optional custom predicates.
  • The article cites LineReader as an example helper that uses the scanner to split lines, handle `\n` and `\r\n`, and trim trailing `\r` from malformed input.

Hottest takes

"this can't be more than 20% along it" — mrkeen
"simple URL parsing breaks on so many things" — f311a
"parsing complex data becomes a fun puzzle" — speedgoose
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.