What is it?

When we implement a programming language, we usually have to write parser and a pretty-printer. However, manually writing both programs is not only tedious but also error-prone; it may happen that a pretty-printed result is not correctly parsed.

FliPpr, which is a program transformation system that uses program inversion to produce a CFG parser from a pretty-printer, will solve the problem. Thanks to the program inversion, the consistency between a given pretty-printer and the derived parser is guaranteed. The advantages of our system are:

How to Install?


FliPpr requires GHC, alex and happy. These programs will be installed if you install Haskell Platform.

We have tested GHC 7.4.1, alex 3.0.1, and happy 1.18.9.


  1. Download the tarball of FliPpr.
  2. Expand the downloaded tarball.
  3. Move to the generated directory.
  4. Type make

How to Use?


The OUTPUTFILE contains a definition of a pretty-printer copied from INPUTFILE and a parser. For a pretty-printing function f, which must be declared in topmost line, a parsing function parse_f is generated.

Examples directory contains a few examples.

NB: The current implementation is hardwired to use Examples/Defs.hs for input datatypes and so on, which will be fixed in some future.


The current implement is prototype. It needs much more effort to be a practical tool, especially, in the following points.