flippre is an embedded implementation of FliPpr, an invertible pretty-printing system. The library provides functions and datatypes that enable you to define pretty-printers in a functional programming style while ensuring they remain invertible to produce context-free grammar (CFG) parsers. (The current implementation relies on the Earley library for parsing.)
This repository consists of four packages:
flippre: The embedded FliPpr system.flippre-examples: Examples of invertible pretty-printers defined using FliPpr.flippre-grammar-backend: Internally used for grammar processing within FliPpr.mutual-def-class: Internally used for observable mutually recursive definitions.
You can build the project using either stack or cabal.
Using stack:
stack buildUsing cabal
cabal build allYou can find examples in the flippre-examples directory. For instance, For instance, Arith.hs demonstrates an invertible pretty-printer for simple arithmetic expressions. You can experiment with these examples in a REPL as follows:
Using stack:
stack repl flippre-examples:exe:arith Using cabal:
cabal repl arith- Kazutaka Matsuda, Meng Wang: Embedding invertible languages with binders: a case of the FliPpr language. Haskell Symposium 2018: 158-171
- Kazutaka Matsuda, Meng Wang: FliPpr: A System for Deriving Parsers from Pretty-Printers. New Generation Computing 36(3): 173-202 (2018)
- Kazutaka Matsuda, Meng Wang: FliPpr: A Prettier Invertible Printing System. ESOP 2013: 101-120