The Language type that is the core of GroteTrap.
- data Language a = Language {}
- language :: Language a
- data Operator a
- data Fixity1
- data Fixity2
- isUnary :: Operator a -> Bool
- isBinary :: Operator a -> Bool
- isNary :: Operator a -> Bool
- findOperator :: Monad m => String -> [Operator a] -> m (Operator a)
- data Function a = Function {}
- findFunction :: Monad m => String -> [Function a] -> m (Function a)
- function1 :: (a -> a) -> String -> Function a
- function2 :: (a -> a -> a) -> String -> Function a
Language
Language connects the syntax of identifiers, numbers, operators and functions with their semantics. GroteTrap is able to derive a parser and evaluator from a Language, as well as convert between source text selections and tree selections.
An empty language. Use this as the starting base of your languages, setting only those fields that are of importance.
Operators
Representation of an operator.
Fixity for unary operators.
Fixity for infix binary operators.
findOperator :: Monad m => String -> [Operator a] -> m (Operator a)Source
Yields the specified operator in a monad. Fails when there are no operators with the name, or where there are several operators with the name.
Functions
Representation of a function.