t3.at builds a parser, a program that turns text into structured data, from a handful of small TypeScript functions. Each function reads part of a string and returns both its result and the text left over. Parser combinators join those functions into larger parsers using the same interface.

The tutorial builds three operations:

  • Sequence: run several parsers in order, passing the remaining text to the next one.
  • Map: turn the extracted values into a useful object, such as a greeting with a name.
  • Repeat: apply a parser until it fails, collecting the results.

Those pieces become a parser for ping output, the text a network diagnostic command prints. Separate functions handle the header, packet lines and statistics, then combine into one structured result.

The walkthrough makes function composition concrete: a parser can become a building block without changing how callers use it. Its worked example is small enough to follow from the first string match to the finished object.

The 60-comment thread on Hacker News

What the thread adds

  • boomlinde — “The first address should probably not be parsed as an IP address as it can also be a hostname.”
  • debugnik — “we usually consider it a programmer error if elem matches the empty string in repeat(elem)”.
  • BoppreH — “Importantly, it processes the list in one pass and ensures the matches are contiguous, where a naive re.findall with capture groups will ignore unmatched characters.” On Python’s re.Scanner: “It’s a regex-based tokenizer… (so no recursive parsing)”.
  • ArneCode — “you have to add a lot of mapping / unwrapping code. In my opinion this makes the parsers harder to read.” pdpi, replying with a Winnow example, disagrees: “Not really that much (un)wrapping logic”.

Handles are pseudonymous; HN publishes no per-comment scores and orders comments by its own ranking, so this is a slice of the thread, not a consensus.