uu-cco-0.1.0.1: Utilities for compiler construction: core functionality

Portabilityportable
Stabilityprovisional
Maintainerstefan@cs.uu.nl
Safe HaskellSafe-Inferred

CCO.Tree.Parser

Contents

Description

A set of simple parsing utilities that facilitate the conversion from ATerms to Trees.

Synopsis

Parsing ATerms

data TreeParser a Source

Parser that consumes ATerms and, if successful, produces a value of a specified type.

Instances

Functor TreeParser 

integer :: TreeParser IntegerSource

A TreeParser that consumes an Integer term.

float :: TreeParser DoubleSource

A TreeParser that consumes a Float term.

string :: TreeParser StringSource

A TreeParser that consumes a String term.

app :: Con -> ArgumentParser a -> TreeParser aSource

A TreeParser that consumes an application of a given constructor and that uses a specified ArgumentParser to parse the argument terms of the application.

tuple :: ArgumentParser a -> TreeParser aSource

A TreeParser that consumes a tuple term and that uses a specified ArgumentParser to parse the component terms of the tuple.

list :: [TreeParser a] -> TreeParser [a]Source

A TreeParser that consumes a list term and that uses a specified family of TreeParsers to parse the elements of the list.

parseTree :: [TreeParser a] -> ATerm -> Feedback aSource

Uses a family of TreeParsers to parse a given ATerm.

Parsing arguments

data ArgumentParser a Source

Parser that consumes a list of ATerms and, if successful, produces a value of a specified type.

Instances

Functor ArgumentParser 
Applicative ArgumentParser 

arg :: Tree a => ArgumentParser aSource

An ArgumentParser that consumes a single ATerm, converting it to a Tree of the appropriate type.