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
Contents
Synopsis
- data Parser
- data Token
- value <|>
- value <~>
- value ==>
- value nul
- value ter
- value eps
- value emp
- value derive
- value compact
- value parseNull
- value defaultCompactSteps
- value compactNum
- value deriveStepNum
- value runParseNum
- value runParseStagesNum
- value runParseStages
- value runParseLongestMatchNum
- value runParseLongestMatch
- value deriveStep
- value runParse
- value xsR
- value xsL
- value xsIn
- value parens
- value parensIn
- value amb
- value ambIn
- value sexp
- value sexpIn
- value someStuff
- value someStuffG
- Packagederp-0.1.6
- Exports33
- LanguageHaskell98
- LicenceBSD-3-Clause
- SourceDerp.hs
Data Types
Constructors
TokentokenClass :: ttokenValue :: String
Parser construction
Alternation.
Concatenation.
Reduction.
Null-parse extraction.
Terminal.
Epsilon/empty-string.
The empty language.
Parser computation steps
The main derivative function.
The optimization step of the algorithm.
Extract the parse-null set of a parser.
Full parsing and result extraction
The 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]