This module defines the basic data structures for representing graphs and hypergraphs and the corresponding graph parsers.
getSemRep
:: (a,[(b,[Int])]) -> a
Access the semantic representation of the result of a graph parser. |
pSucceed
:: a -> [(b,[Int])] -> (a,[(b,[Int])])
Given an arbitrary value v , pSucceed
always succeeds
returning v
as a result without any consumption of the input graph g .
|
eoi
:: [(a,[Int])] -> ((),[(a,[Int])])
eoi
succeeds only if the graph is already completely consumed.
|
edge
:: (a,[Int]) -> [(a,[Int])] -> ((),[(a,[Int])])
The parser edge e
succeeds only if the given edge e
is part of the
given input graph g .
|
(<|>)
:: ([(a,[Int])] -> (b,[(a,[Int])])) -> ([(a,[Int])] -> (b,[(a,[Int])])) -> [(a,[Int])] -> (b,[(a,[Int])])
The choice between two parsers. |
(<*>)
:: ([(a,[Int])] -> (b -> c,[(a,[Int])])) -> ([(a,[Int])] -> (b,[(a,[Int])])) -> [(a,[Int])] -> (c,[(a,[Int])])
The successive application of two parsers where the result is constructed by function application. |
(<$>)
:: (a -> b) -> ([(c,[Int])] -> (a,[(c,[Int])])) -> [(c,[Int])] -> (b,[(c,[Int])])
|
(<$)
:: a -> ([(b,[Int])] -> (c,[(b,[Int])])) -> [(b,[Int])] -> (a,[(b,[Int])])
|
(<*)
:: ([(a,[Int])] -> (b,[(a,[Int])])) -> ([(a,[Int])] -> (c,[(a,[Int])])) -> [(a,[Int])] -> (b,[(a,[Int])])
|
(*>)
:: ([(a,[Int])] -> (b,[(a,[Int])])) -> ([(a,[Int])] -> (c,[(a,[Int])])) -> [(a,[Int])] -> (c,[(a,[Int])])
|
chain
:: ((Int,Int) -> [(a,[Int])] -> (b,[(a,[Int])])) -> (Int,Int) -> [(a,[Int])] -> ([b],[(a,[Int])])
The combinator chain p (n1,n2)
can be used to identify
a non-empty chain of graphs that can be parsed with p .
|
All nodes are numbered.
Type synonym: Node = Int
A type for the edge labels t
can be passed as a type parameter.
In the simplest case this can be just strings representing their labels.
The tentacle numbers correspond to the position of a node in the
list of incident nodes.
Type synonym: Edge a = (a,[Node])
A graph is declared as a list of edges each with its incident nodes
Type synonym: Graph a = [Edge a]
The type of a graph parser. It is parameterized over the
type res
of semantic values associated to graphs.
Type synonym: Grappa a b = Graph a -> (b,Graph a)
Access the semantic representation of the result of a graph parser.
|
Given an arbitrary value
|
|
The parser |
The choice between two parsers. |
The successive application of two parsers where the result is constructed by function application. |
|
|
|
|
The combinator |