Sdf2HaskellContentsIndex
Sdf2Pretty
Portability portable
Stability experimental
Maintainer Joost Visser
Contents
Starting point
Generation of imports
Generation of function definitions
Description
This module is part of Sdf2Haskell, a tool for generating Haskell code from an SDF grammar. This module contains functions generating pretty-print support.
Synopsis
generatePrettyModule :: String -> String -> SDF -> HsModule
prettyImports :: String -> [HsImportDecl]
genPrettyDecls :: String -> SDF -> [HsDecl]
genPrettyFun :: String -> SDF -> [HsDecl]
genInstDecls :: SDF -> [HsDecl]
production2instdecl :: Production -> Maybe HsDecl
symbols2pvars :: [Symbol] -> [HsPat]
symbols2docs :: [Symbol] -> [HsExp]
symbol2doc :: (String, Symbol) -> HsExp
Starting point
generatePrettyModule :: String -> String -> SDF -> HsModule
Generate a Haskell model with functions for pretty-printing support
Generation of imports
prettyImports :: String -> [HsImportDecl]
Generate the import list
Generation of function definitions
genPrettyDecls :: String -> SDF -> [HsDecl]
Generate both instance declarations and the generic pretty-printing function.
genPrettyFun :: String -> SDF -> [HsDecl]
Generate the generic pretty-printing function.
genInstDecls :: SDF -> [HsDecl]
Generate the instance declarations.
production2instdecl :: Production -> Maybe HsDecl
Generate an instance declaration from an Sdf production
symbols2pvars :: [Symbol] -> [HsPat]
Convert Sdf symbols into Haskell pattern variables.
symbols2docs :: [Symbol] -> [HsExp]
Convert Sdf symbols into Doc expressions.
symbol2doc :: (String, Symbol) -> HsExp
Convert an Sdf symbol into a Doc expression.
Produced by Haddock version 0.6