A pretty printer 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 ugly printer is sufficient.

pretty printers 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 generic pretty printing (gpp) package that comes with StrategoXT provides tools for translating terms to the Box language? and formatting the Box language? to text, html, and latex. The package even supports generation of pretty print tables from SDF syntax definitions.

If you need more control over pretty printing you can also write a pretty printer with StrategoBox. This approach uses concrete syntax for the Box language? inside the Stratego language.


CategoryPrettyPrint?

Revision: r1.4 - 17 May 2003 - 13:19 - MartinBravenboer
Stratego > StrategoGlossary > PrettyPrinter
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback