Thu 7 Sep 2017 11:00 - 11:30 at L1 - Day 1, Session 2
We present a novel but remarkably simple formulation of formal language grammars in Haskell as functions mapping a record of production parsers to itself. Thus formulated grammars are first-class objects, composable and reusable. We also provide a simple parser implementation for them, based on an improved packrat algorithm. In order to make the grammar manipulation code reusable, we introduce a set of type classes mirroring the existing type classes from Haskell base library, but whose methods have rank-2 types.