GroteTrap-0.3: GroteTrap

Language.GroteTrap.ParseTree

Contents

Description

A generic parse tree. A ParseTree and a Language together provide enough information to fully evaluate the input sentence.

Synopsis

Type ParseTree

Catamorphisms

data ParseTreeAlg a Source

An algebra for parse trees catamorphisms.

Constructors

ParseTreeAlg 

Fields

algId :: Pos -> String -> a
 
algInt :: Pos -> Int -> a
 
algUnary :: Range -> String -> a -> a
 
algBinary :: Range -> String -> a -> a -> a
 
algList :: Bool -> [Range] -> String -> [a] -> a
 
algCall :: Range -> String -> [a] -> a
 
algParens :: Range -> a -> a
 

foldParseTree :: ParseTreeAlg a -> ParseTree -> aSource

Folds parse trees using an algebra.

Evaluation

evaluate :: Language a -> ParseTree -> aSource

Evaluates a parse tree from a language.