Represents both a formal context-free language and the
reduction of a member of that language to a value of type a.
Modulederp-0.1.6Haskell98
Text.Derp
- 2 types
- 31 values
- Packagederp-0.1.6
- Exports33
- LanguageHaskell98
- LicenceBSD-3-Clause
- SourceDerp.hs
Data Types
2 declarationsConstructors
TokentokenClass :: ttokenValue :: String
Parser construction
7 declarationsAlternation.
Concatenation.
Reduction.
Null-parse extraction.
Terminal.
Epsilon/empty-string.
The empty language.
Parser computation steps
3 declarationsThe main derivative function.
The optimization step of the algorithm.
Extract the parse-null set of a parser.
Full parsing and result extraction
10 declarationsThe number of compact steps that usually keeps a parser constant in size while parsing.
A specified number of compactions.
Derivation followed by a specified number of compactions.
Parse using a specified number of intermediate compactions.
Derivation followed by the default number of compactions.
Parse using the default number of intermediate compactions. This is the main parsing function. Examples:
let e = ter "num"
<|> e <~> ter "+" <~> e ==> (\(x1,(o,x2)) -> "(" ++ x1 ++ o ++ x2 ++ ")")
in runParse e [Token "num" "1", Token "+" "+", Token "num" 3", Token "+" "+", Token "num" "5"]evaluates to:
Set.fromList ["((1+3)+5)", "(1+(3+5))"]let e = ter "num" ==> read
<|> e <~> ter "+" <~> e ==> (\(x1,(_,x2)) -> x1 + x2)
in runParse e [Token "num" "1", Token "+" "+", Token "num" 3", Token "+" "+", Token "num" "5"]evaluates to:
Set.fromList [9]