sifflet-2.3.0: Simple, visual, functional language for learning about recursion.

Safe HaskellSafe
LanguageHaskell2010

Language.Sifflet.Parser

Description

A parser for Sifflet input values. This is not a parser for all Sifflet expressions, but just those that might be input in textual form through the function call dialog that asks for the argument values. So, it is limited (deliberately) to "data" types of expressions: that is, Exprs using the constructors: ELit EList That means excluding Exprs constructed with EUndefined, ESymbol, EIf, ELambda, and ECall.

Synopsis

Documentation

parseExpr :: String -> SuccFail Expr Source

Parse a Sifflet data literal (number, string, char, bool, or list), returning an Expr

parseValue :: String -> SuccFail Value Source

Parse a Sifflet literal expression and return its Value

parseTest :: (Stream s Identity t, Show a) => Parsec s () a -> s -> IO ()

The expression parseTest p input applies a parser p against input input and prints the result to stdout. Used for testing parsers.

parseTypedInput2 :: (String, Type) -> SuccFail Value Source

Try to parse an input value of a specific type

parseTypedInputs2 Source

Arguments

:: [String]

input strings

-> [Type]

expected types

-> SuccFail [Value] 

Try to parse input values of specific types

parseTypedInput3 :: (String, String, Type) -> SuccFail Value Source

Try to parse an input value for a named variable of a specific type

parseTypedInputs3 Source

Arguments

:: [String]

inputs

-> [String]

variable names

-> [Type]

variable types

-> SuccFail [Value] 

Try to parse input values for named variables of specific types

nothingBut :: Parser a -> Parser a Source

'nothingBut p is like p, but consumes the entire input, so there must be no extraneous characters (except space) after whatever p parses.

expr :: Parser Expr Source

Parse a Sifflet data expression -- actually only a literal or a list of literals.

list :: Parser a -> Parser [a] Source

value :: Parser Value Source

Parser for a Value of any primitive or (concrete) list type

typedValue :: Type -> Parser Value Source

Parser for a value with a specific primitive or concrete list type expected.