~/talk

Parser Combinators

slides:none on file

A Haskell-style parser combinator library is implemented in PHP that models parsers as functions returning success or error plus remainder, with concrete combinators: partial combinators, sequence, append and either, and a map combinator to transform parsed values. The author builds a working JSON parser (~230-line implementation) and expression/calculator parsers, using a Result class for success/fail and recursive composition. It runs correctly (but is slower than native PHP parsers) and includes tests showing parsed values, remainders and error messages.

AI-written summary · about

  1. 0:00Introduction and setup
  2. 1:04What is a parser?
  3. 5:42Defining a parser function
  4. 9:24Creating a generic parser
  5. 12:32Combining parsers with sequence
  6. 18:52Appending parsed values
  7. 23:08Parsing alternatives with either
  8. 26:40Mapping parsed results
  9. 33:47Building an AST with map
  10. 35:33Real-world parser combinator use
  11. 38:50Recursive parsing in practice
  12. 40:15Summary and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.