Safe Haskell | None |
---|---|
Language | Haskell98 |
DDC.Core.Parser
Contents
Description
Core language parser.
- type Parser n a = Parser (Token n) a
- data Context n = Context {}
- contextOfProfile :: Profile n -> Context n
- pType :: Ord n => Context n -> Parser n (Type n)
- pTypeApp :: Ord n => Context n -> Parser n (Type n)
- pTypeAtom :: Ord n => Context n -> Parser n (Type n)
- pModule :: (Ord n, Pretty n) => Context n -> Parser n (Module SourcePos n)
- pModuleName :: Pretty n => Parser n ModuleName
- pExp :: Ord n => Context n -> Parser n (Exp SourcePos n)
- pExpApp :: Ord n => Context n -> Parser n (Exp SourcePos n)
- pExpAtom :: Ord n => Context n -> Parser n (Exp SourcePos n)
- data ParamSpec n
- = ParamType (Bind n)
- | ParamWitness (Bind n)
- | ParamValue (Bind n) (Type n) (Type n)
- funTypeOfParams :: Context n -> [ParamSpec n] -> Type n -> Type n
- expOfParams :: a -> [ParamSpec n] -> Exp a n -> Exp a n
- pBindParamSpecAnnot :: Ord n => Context n -> Parser n [ParamSpec n]
- pBindParamSpec :: Ord n => Context n -> Parser n [ParamSpec n]
- pWitness :: Ord n => Context n -> Parser n (Witness SourcePos n)
- pWitnessApp :: Ord n => Context n -> Parser n (Witness SourcePos n)
- pWitnessAtom :: Ord n => Context n -> Parser n (Witness SourcePos n)
- pCon :: Parser n n
- pConSP :: Parser n (n, SourcePos)
- pLit :: Parser n (Literal, Bool)
- pLitSP :: Parser n ((Literal, Bool), SourcePos)
- pIndex :: Parser n Int
- pIndexSP :: Parser n (Int, SourcePos)
- pVar :: Parser n n
- pVarSP :: Parser n (n, SourcePos)
- pBinder :: Ord n => Parser n (Binder n)
- pName :: Parser n n
- pOpSP :: Parser n (String, SourcePos)
- pOpVarSP :: Parser n (String, SourcePos)
- pSym :: Symbol -> Parser n SourcePos
- pKey :: Keyword -> Parser n SourcePos
- pTok :: TokenAtom -> Parser n ()
- pTokSP :: TokenAtom -> Parser n SourcePos
- pTokAs :: TokenAtom -> a -> Parser n a
Documentation
Configuration and information from the context. Used for context sensitive parsing.
Constructors
Context | |
Fields
|
contextOfProfile :: Profile n -> Context n Source #
Types
pTypeAtom :: Ord n => Context n -> Parser n (Type n) Source #
Parse a variable, constructor or parenthesised type.
Modules
pModule :: (Ord n, Pretty n) => Context n -> Parser n (Module SourcePos n) Source #
Parse a core module.
pModuleName :: Pretty n => Parser n ModuleName Source #
Parse a module name.
Expressions
pExpAtom :: Ord n => Context n -> Parser n (Exp SourcePos n) Source #
Parse a variable, constructor or parenthesised expression.
Function Parameters
Specification of a function parameter. We can determine the contribution to the type of the function, as well as its expression based on the parameter.
Constructors
ParamType (Bind n) | |
ParamWitness (Bind n) | |
ParamValue (Bind n) (Type n) (Type n) |
Arguments
:: Context n | |
-> [ParamSpec n] | Spec of parameters. |
-> Type n | Type of body. |
-> Type n | Type of whole function. |
Build the type of a function from specifications of its parameters, and the type of the body.
Arguments
:: a | |
-> [ParamSpec n] | Spec of parameters. |
-> Exp a n | Body of function. |
-> Exp a n | Expression of whole function. |
Build the expression of a function from specifications of its parameters, and the expression for the body.
pBindParamSpecAnnot :: Ord n => Context n -> Parser n [ParamSpec n] Source #
Parse a function parameter specification, requiring a full type (or kind) annotation.
pBindParamSpec :: Ord n => Context n -> Parser n [ParamSpec n] Source #
Parse a function parameter specification, with an optional type (or kind) annotation.
Witnesses
pWitness :: Ord n => Context n -> Parser n (Witness SourcePos n) Source #
Parse a witness expression.
pWitnessApp :: Ord n => Context n -> Parser n (Witness SourcePos n) Source #
Parse a witness application.
pWitnessAtom :: Ord n => Context n -> Parser n (Witness SourcePos n) Source #
Parse a variable, constructor or parenthesised witness.
Constructors
pLitSP :: Parser n ((Literal, Bool), SourcePos) Source #
Parse a numeric literal, with source position.