rewire-frontend-2.8: A Haskell-to-Verilog/VHDL compiler, front end (GHC driver, Eidos, Synolon)
Safe HaskellSafe
LanguageHaskell2010

ReWire.Synolon.Pretty

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.

Synopsis

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.

ppProc :: Proc -> Doc an Source #

proc P : ty ~> ty clock? { state* entry block* }.

ppBlock :: Id -> Block -> Doc an Source #

ppCmd :: Cmd -> Doc an Source #

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).

Orphan instances

Pretty Block Source # 
Instance details

Methods

pretty :: Block -> Doc ann #

prettyList :: [Block] -> Doc ann

Pretty Proc Source # 
Instance details

Methods

pretty :: Proc -> Doc ann #

prettyList :: [Proc] -> Doc ann

Pretty Program Source # 
Instance details

Methods

pretty :: Program -> Doc ann #

prettyList :: [Program] -> Doc ann