Copyright | (c) 2018-2024 Dakotah Lambert |
---|---|
License | MIT |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Extensions | Cpp |
The (P)iecewise / (L)ocal (E)xpression (B)uilder.
This module defines a parser for a representation of
logical formulae over subsequence- and adjacency-factors,
as well as a mechanism for evaluating (creating an FSA
from)
the resulting expression tree.
There are two special variables:
it
describes the most recent expression, anduniverse
collects all symbols used.
Synopsis
- type Dictionary a = Map String a
- newtype Parse a = Parse {}
- type Env = (Dictionary (Set String), Dictionary Expr)
- data Expr
- data SymSet
- data Token
- compileEnv :: Env -> Env
- groundEnv :: Env -> Env
- insertExpr :: Env -> Expr -> Env
- fromAutomaton :: FSA Integer String -> Expr
- fromSemanticAutomaton :: FSA Integer (Maybe String) -> Expr
- makeAutomaton :: Env -> Expr -> Maybe (FSA Integer (Maybe String))
- makeAutomatonE :: Env -> Expr -> Either String (FSA Integer (Maybe String))
- doStatements :: Env -> String -> Env
- doStatementsWithError :: Env -> String -> Either String Env
- parseExpr :: Parse Expr
- readPleb :: String -> Either String (FSA Integer String)
- restoreUniverse :: Env -> Env
- restrictUniverse :: Env -> Env
- tokenize :: String -> [Token]
Documentation
type Dictionary a = Map String a #
An association between names and values.
The base type for a combinatorial parser.
type Env = (Dictionary (Set String), Dictionary Expr) #
The environment: defined sets of symbols and defined expressions.
An expression, the root of an expression tree.
compileEnv :: Env -> Env #
Transform all saved expressions into automata to prevent reevaluation.
Convert saved automata from descriptions of constraints to descriptions of stringsets. This action effectively removes metadata describing constraint types from the environment.
insertExpr :: Env -> Expr -> Env #
Add a new expression to the environment, call it "(it)
".
fromSemanticAutomaton :: FSA Integer (Maybe String) -> Expr #
Generate an expression (sub)tree from an FSA
that
contains metadata regarding the constraint(s) it represents.
makeAutomaton :: Env -> Expr -> Maybe (FSA Integer (Maybe String)) #
Create an FSA
from an expression tree and environment,
complete with metadata regarding the constraint(s) it represents.
makeAutomatonE :: Env -> Expr -> Either String (FSA Integer (Maybe String)) #
Create an FSA
from an expression tree and environment,
complete with metadata regarding the constraint(s) it represents.
doStatements :: Env -> String -> Env #
Parse an input string and update the environment according to the result of the parse.
doStatementsWithError :: Env -> String -> Either String Env #
Parse an input string and update the environment according to the result of the parse. Pass along errors encountered.
readPleb :: String -> Either String (FSA Integer String) #
Parse an input string and create a stringset-automaton from the result.
restoreUniverse :: Env -> Env #
Reset the "universe
" to contain all and only other symbols used.
Since: 1.2
restrictUniverse :: Env -> Env #
Remove any symbols not present in (universe)
from the environment.