| Copyright | (c) 2018-2024 Dakotah Lambert | 
|---|---|
| License | MIT | 
| Safe Haskell | Safe-Inferred | 
| Language | Haskell2010 | 
| Extensions | Cpp | 
LTK.Porters.Pleb
Description
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:
itdescribes the most recent expression, anduniversecollects 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 Source #
An association between names and values.
The base type for a combinatorial parser.
type Env = (Dictionary (Set String), Dictionary Expr) Source #
The environment: defined sets of symbols and defined expressions.
An expression, the root of an expression tree.
A set of symbols.
A syntactic unit.
compileEnv :: Env -> Env Source #
Transform all saved expressions into automata to prevent reevaluation.
groundEnv :: Env -> Env Source #
Convert saved automata from descriptions of constraints to descriptions of stringsets. This action effectively removes metadata describing constraint types from the environment.
fromSemanticAutomaton :: FSA Integer (Maybe String) -> Expr Source #
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)) Source #
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)) Source #
Create an FSA from an expression tree and environment,
 complete with metadata regarding the constraint(s) it represents.
doStatements :: Env -> String -> Env Source #
Parse an input string and update the environment according to the result of the parse.
doStatementsWithError :: Env -> String -> Either String Env Source #
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) Source #
Parse an input string and create a stringset-automaton from the result.
restoreUniverse :: Env -> Env Source #
Reset the "universe" to contain all and only other symbols used.
Since: 1.2
restrictUniverse :: Env -> Env Source #
Remove any symbols not present in (universe) from the environment.