Pretty Printer

Stratego -- Strategies for Program Transformation
A PrettyPrinter is a mapping from terms to text. If this is done in a nice way, i.e., layout is placed in appropriate places, the formatter deserves the term _pretty_-printer. For some applications, e.g., inspecting an intermediate term in a transformation pipeline, an UglyPrinter is sufficient.

PrettyPrinters can be defined manually, but that is a lot of work. A better way is to use an intermediate format for representing layout instructions and leaving the actual formatting to a tool that knows about it.

The GenericPrettyPrinting package that comes with StrategoXT provides tools for translating terms to the BoxLanguage? and formatting the BoxLanguage? to text, html, and latex. The package even supports generation of PrettyPrintTables from SDF syntax definitions.

If you need more control over pretty printing you can also write a PrettyPrinter with StrategoBox. This approach uses ConcreteSyntax for the BoxLanguage? inside the StrategoLanguage .

-- EelcoVisser - 28 Nov 2001