A library for expressing programming language grammars in a form similar to BNF, which is extended with the semantic actions to take when a production has been parsed. The grammars are typed and are to be be used with the LALR(1) parser generator, also part of the library, which can generate a parser for the language either at compile time using Template Haskell, producing fast parsers with no initial runtime overhead, or dynamically, which has the initial overhead of generating the parser, but can be used for example when the grammar depends on an input.