Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type AnnotatedUPT = Cofree UnprocessedParsedTermF LocTag
- type TelomareParser = Parsec Void String
- parseVariable :: TelomareParser AnnotatedUPT
- lineComment :: TelomareParser ()
- blockComment :: TelomareParser ()
- sc :: TelomareParser ()
- scn :: TelomareParser ()
- lexeme :: TelomareParser a -> TelomareParser a
- symbol :: String -> TelomareParser String
- reserved :: String -> TelomareParser ()
- rws :: [String]
- identifier :: TelomareParser String
- parens :: TelomareParser a -> TelomareParser a
- brackets :: TelomareParser a -> TelomareParser a
- curlies :: TelomareParser a -> TelomareParser a
- commaSep :: TelomareParser a -> TelomareParser [a]
- integer :: TelomareParser Integer
- getLineColumn :: ParsecT Void String Identity LocTag
- parseString :: TelomareParser AnnotatedUPT
- parseNumber :: TelomareParser AnnotatedUPT
- parsePair :: TelomareParser AnnotatedUPT
- parseUnsizedRecursion :: TelomareParser AnnotatedUPT
- parseList :: TelomareParser AnnotatedUPT
- parseITE :: TelomareParser AnnotatedUPT
- parseHash :: TelomareParser AnnotatedUPT
- parseCase :: TelomareParser AnnotatedUPT
- parseSingleCase :: TelomareParser (Pattern, AnnotatedUPT)
- parsePattern :: TelomareParser Pattern
- parsePatternPair :: TelomareParser Pattern
- parsePatternInt :: TelomareParser Pattern
- parsePatternString :: TelomareParser Pattern
- parsePatternVar :: TelomareParser Pattern
- parsePatternIgnore :: TelomareParser Pattern
- parseSingleExpr :: TelomareParser AnnotatedUPT
- parseApplied :: TelomareParser AnnotatedUPT
- parseLambda :: TelomareParser AnnotatedUPT
- parseSameLvl :: Pos -> TelomareParser a -> TelomareParser a
- parseLet :: TelomareParser AnnotatedUPT
- parseLongExpr :: TelomareParser AnnotatedUPT
- parseChurch :: TelomareParser AnnotatedUPT
- parseRefinementCheck :: TelomareParser (AnnotatedUPT -> AnnotatedUPT)
- parseAssignment :: TelomareParser (String, AnnotatedUPT)
- parseTopLevel :: TelomareParser AnnotatedUPT
- parseTopLevelWithPrelude :: [(String, AnnotatedUPT)] -> TelomareParser AnnotatedUPT
- parseDefinitions :: TelomareParser (AnnotatedUPT -> AnnotatedUPT)
- runTelomareParser_ :: Show a => TelomareParser a -> String -> IO ()
- runTelomareParserWDebug :: Show a => TelomareParser a -> String -> IO ()
- runTelomareParser :: Monad m => TelomareParser a -> String -> m a
- parseSuccessful :: Monad m => TelomareParser a -> String -> m Bool
- runParseLongExpr :: String -> Either String UnprocessedParsedTerm
- parsePrelude :: String -> Either String [(String, AnnotatedUPT)]
- parseOneExprOrTopLevelDefs :: [(String, AnnotatedUPT)] -> TelomareParser AnnotatedUPT
- parseWithPrelude :: [(String, AnnotatedUPT)] -> String -> Either String AnnotatedUPT
Documentation
parseVariable :: TelomareParser AnnotatedUPT Source #
Parse a variable.
lineComment :: TelomareParser () Source #
Line comments start with "--".
blockComment :: TelomareParser () Source #
A block comment starts with "{-" and ends at "-}". Nested block comments are also supported.
sc :: TelomareParser () Source #
Space Consumer: Whitespace and comment parser that does not consume new-lines.
scn :: TelomareParser () Source #
Space Consumer: Whitespace and comment parser that does consume new-lines.
lexeme :: TelomareParser a -> TelomareParser a Source #
This is a wrapper for lexemes that picks up all trailing white space using sc
symbol :: String -> TelomareParser String Source #
A parser that matches given text using string internally and then similarly picks up all trailing white space.
reserved :: String -> TelomareParser () Source #
This is to parse reserved words.
identifier :: TelomareParser String Source #
Variable identifiers can consist of alphanumeric characters, underscore, and must start with an English alphabet letter
parens :: TelomareParser a -> TelomareParser a Source #
Parser for parenthesis.
brackets :: TelomareParser a -> TelomareParser a Source #
Parser for brackets.
curlies :: TelomareParser a -> TelomareParser a Source #
Parser for curly braces
commaSep :: TelomareParser a -> TelomareParser [a] Source #
Comma sepparated TelomareParser that will be useful for lists
integer :: TelomareParser Integer Source #
Integer TelomareParser used by parseNumber
and parseChurch
parseString :: TelomareParser AnnotatedUPT Source #
Parse string literal.
parseNumber :: TelomareParser AnnotatedUPT Source #
Parse number (Integer).
parsePair :: TelomareParser AnnotatedUPT Source #
Parse a pair.
parseUnsizedRecursion :: TelomareParser AnnotatedUPT Source #
Parse unsized recursion triple
parseList :: TelomareParser AnnotatedUPT Source #
Parse a list.
parseITE :: TelomareParser AnnotatedUPT Source #
Parse ITE (which stands for "if then else").
parseSingleExpr :: TelomareParser AnnotatedUPT Source #
Parse a single expression.
parseApplied :: TelomareParser AnnotatedUPT Source #
Parse application of functions.
parseLambda :: TelomareParser AnnotatedUPT Source #
Parse lambda expression.
parseSameLvl :: Pos -> TelomareParser a -> TelomareParser a Source #
Parser that fails if indent level is not pos
.
parseLet :: TelomareParser AnnotatedUPT Source #
Parse let expression.
parseLongExpr :: TelomareParser AnnotatedUPT Source #
Parse long expression.
parseChurch :: TelomareParser AnnotatedUPT Source #
Parse church numerals (church numerals are a "$" appended to an integer, without any whitespace separation).
parseRefinementCheck :: TelomareParser (AnnotatedUPT -> AnnotatedUPT) Source #
Parse refinement check.
parseAssignment :: TelomareParser (String, AnnotatedUPT) Source #
Parse assignment add adding binding to ParserState.
parseTopLevel :: TelomareParser AnnotatedUPT Source #
Parse top level expressions.
parseTopLevelWithPrelude Source #
:: [(String, AnnotatedUPT)] | Prelude |
-> TelomareParser AnnotatedUPT |
Parse top level expressions.
runTelomareParser_ :: Show a => TelomareParser a -> String -> IO () Source #
Helper function to test parsers without a result.
runTelomareParserWDebug :: Show a => TelomareParser a -> String -> IO () Source #
Helper function to debug parsers without a result.
runTelomareParser :: Monad m => TelomareParser a -> String -> m a Source #
Helper function to test Telomare parsers with any result.
parseSuccessful :: Monad m => TelomareParser a -> String -> m Bool Source #
Helper function to test if parser was successful.
parsePrelude :: String -> Either String [(String, AnnotatedUPT)] Source #
parseOneExprOrTopLevelDefs :: [(String, AnnotatedUPT)] -> TelomareParser AnnotatedUPT Source #
Parse either a single expression or top level definitions defaulting to the main
definition.
This function is useful and was made for telomare-evaluare
:: [(String, AnnotatedUPT)] | Prelude |
-> String | Raw string to be parsed |
-> Either String AnnotatedUPT | Error on Left |
Parse with specified prelude