OXFORD UNIVERSITY  COMPUTING LABORATORY

Haskell2LaTeX

Haskell2LaTeX takes a literate Haskell program, or any LaTeX document with embedded Haskell, and pretty-prints the Haskell sections within it. The most significant difference between Haskell2LaTeX and other programs with similar goals is is that Haskell2LaTeX parses the input rather than merely lexing it. While this is not currently fully exploited, it allows greater flexibility in laying out the code; hopefully it will be extended to take greater advantage of this in the future.

The parser used is based on a parser combinator library and automaton generator of my own creation. The code is, to the greatest extent practical, isomorphic to the Haskell 98 report. This will hopefully make it easy to update and alter; for example, it should be straightforward to add the FFI productions to the lexer, automaton and parser. Both the parser combinator library and automaton generator are easy to use in other projects; for example, the automaton generator and an EPS optimiser used for my undergraduate report use the parser combinator library.

Example before and after pictures of Haskell2LaTeX in action

The current code, Haskell2LaTeX 0.3.0, is sub-optimal in a few respects, but it is certainly usable. Feel free to grab a copy and either use it as is or improve it; a copy of any improvements would be much appreciated! The licence is GNU GPL v2.

You can also have a look at my undergraduate report (in PDF or gzipped postscript format) and the slides for a talk (in PDF format and the source) I did on it. For another example of the output see the Hetris document.


Back to the main page.

Random Image
Random Image
Random Image