syntactic-0.2: Generic abstract syntax, and utilities for embedded languages




class Render expr whereSource

Render an expression as concrete syntax. A complete instance must define either of the methods render and renderPart.


render :: expr a -> StringSource

Render an expression as a String

renderPart :: [String] -> expr a -> StringSource

Render a partially applied constructor given a list of rendered missing arguments


Render Literal 
Render PrimFunc 
Render Condition 
Render Select 
Render Tuple 
Render Let 
Render Lambda 
Render Variable 
Render dom => Render (AST dom) 
(Render expr1, Render expr2) => Render (:+: expr1 expr2) 
Render expr => Render (Ann info expr) 

printExpr :: Render expr => expr a -> IO ()Source

Print an expression

class Render expr => ToTree expr whereSource


toTreePart :: [Tree String] -> expr a -> Tree StringSource

Convert a partially applied constructor to a syntax tree given a list of rendered missing arguments


ToTree Literal 
ToTree PrimFunc 
ToTree Condition 
ToTree Select 
ToTree Tuple 
ToTree Let 
ToTree Lambda 
ToTree Variable 
ToTree dom => ToTree (AST dom) 
(ToTree expr1, ToTree expr2) => ToTree (:+: expr1 expr2) 
ToTree expr => ToTree (Ann info expr) 

showAST :: ToTree dom => AST dom a -> StringSource

Show syntax tree using ASCII art

drawAST :: ToTree dom => AST dom a -> IO ()Source

Print syntax tree using ASCII art