adp-multi-0.2.0: ADP for multiple context-free languages

Safe HaskellSafe-Inferred



Default model of rewriting functions used in adp-multi.



type SymbolID = (Int, Int)Source

Every 1-dim parser has one symbol, every 2-dim parser two symbols. In a production with parsers p1 to pn, each parser has a number, 1 to n. Each symbol of a parser also has a number, 1 or 2, as only two dimensions are supported now. Both numbers form a unique identifier for each symbol in a production.

Example: f > r

a and c shall have dimension 1, b dimension 2. Then a has id (1,1), b has ids (2,1) and (2,2), and c has (3,1). Applying a rewriting function of type Dim1 or Dim2 to the list of ids produces a permutation of those, possibly split up in two dimensions.

E.g., [(1,1),(2,1),(2,2),(3,1)] gets ([(2,1),(3,1)],[(2,2),(1,1)]) if the rewriting function is: r [a,b1,b2,c] = ([b1,c],[b2,a]).

type Dim1 = [SymbolID] -> [SymbolID]Source

1-dimensional rewriting function

type Dim2 = [SymbolID] -> ([SymbolID], [SymbolID])Source

2-dimensional rewriting function

id1 :: Dim1Source

Convenience rewriting function for one or more dim1 symbols

id2 :: Dim2Source

Convenience rewriting function for one dim2 symbol