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

Language.Syntactic.Analysis.Render

Synopsis

Documentation

class Render expr whereSource

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

Methods

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

Instances

Render Sym 
Render dom => Render (AST dom) 
Render (Literal ctx) 
Render (Condition ctx) 
Render (Select ctx) 
Render (Tuple ctx) 
Render (Lambda ctx) 
Render (Variable ctx) 
Render (Node ctx) 
(Render expr1, Render expr2) => Render (:+: expr1 expr2) 
Render expr => Render (Ann info expr) 
Render (Let ctxa ctxb) 

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

Print an expression

class Render expr => ToTree expr whereSource

Methods

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

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

Instances

ToTree Sym 
ToTree dom => ToTree (AST dom) 
ToTree (Literal ctx) 
ToTree (Condition ctx) 
ToTree (Select ctx) 
ToTree (Tuple ctx) 
ToTree (Lambda ctx) 
ToTree (Variable ctx) 
ToTree (Node ctx) 
(ToTree expr1, ToTree expr2) => ToTree (:+: expr1 expr2) 
ToTree expr => ToTree (Ann info expr) 
ToTree (Let ctxa ctxb) 

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