Parser Combinators (Full Stack Europe)

Improvised presentation on building a parser using pure functional programming in PHP.

By Mathias Verraes
Published on 20 April 2023

I was at Full Stack Europe 2022 in Antwerp, and one of the speakers had to cancel. So I offered to do an improvised talk on Parsers Combinators. (My Covid Lockdown hobby was creating an open source library to help you build parsers, so I have some experience.)

A parser is a function that takes some unstructured input and returns something more structured. One way to write them is using a lot of procedural code. But with parser combinators, you can create a parser declaratively by combining small composable parsers into larger ones.

$parser = between(char('{'), char('}'), atLeastOne(alphaChar()));

In the talk I try to show how these work from first principles.

Watch on YouTube