| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
ReWire.Synolon.Pretty
Contents
Description
The Synolon concrete syntax (.syn) pretty-printer (doc/synolon.md §3.4,
§9): the process declarations, and the program that embeds Eidos datatypes
and definitions (printed by ReWire.Eidos.Pretty, as are the
expressions inside blocks). ReWire.Synolon.Parse is the other half of
the round-trip contract: parse . pretty is the identity modulo
annotations, and pretty . parse . pretty == pretty is a tested
fixpoint.
The Block instance is normative beyond printing: the alpha-equal
block merge of ReWire.Synolon.Transform keys blocks on this rendering
of their canonically renumbered form, so what it prints (parameter
binders, commands with their binders and right-hand sides, the
terminator with its target labels) decides which blocks merge, and so
the state count of every device.
Documentation
prettyProgram :: Program -> Text Source #
Render a whole program in the .syn concrete syntax.
ppProgram :: Program -> Doc an Source #
A whole program: datatypes, definitions, and processes, separated by blank lines.
ppAtomE :: Exp -> Doc an Source #
An expression in an atom position of the machine grammar: the already-atom-shaped forms (variables, literals, constructor and primitive occurrences, which self-parenthesize) print as themselves; anything else parenthesizes (the parser's atom production admits a parenthesized expression).