telomare-0.1.0.0: A simple but robust virtual machine
Safe HaskellSafe-Inferred
LanguageHaskell2010

Telomare.Parser

Synopsis

Documentation

type TelomareParser = Parsec Void String Source #

TelomareParser :: * -> *

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.

rws :: [String] Source #

List of 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

parseNumber :: TelomareParser AnnotatedUPT Source #

Parse number (Integer).

parseUnsizedRecursion :: TelomareParser AnnotatedUPT Source #

Parse unsized recursion triple

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.

parseChurch :: TelomareParser AnnotatedUPT Source #

Parse church numerals (church numerals are a "$" appended to an integer, without any whitespace separation).

parseAssignment :: TelomareParser (String, AnnotatedUPT) Source #

Parse assignment add adding binding to ParserState.

parseTopLevel :: TelomareParser AnnotatedUPT Source #

Parse top level expressions.

parseTopLevelWithPrelude Source #

Arguments

:: [(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.

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

parseWithPrelude Source #

Arguments

:: [(String, AnnotatedUPT)]

Prelude

-> String

Raw string to be parsed

-> Either String AnnotatedUPT

Error on Left

Parse with specified prelude

Orphan instances