ddc-source-tetra-0.4.2.1: Disciplined Disciple Compiler source language.

Safe HaskellNone
LanguageHaskell98

DDC.Source.Tetra.Parser

Contents

Description

Parser for the Source Tetra language.

Synopsis

Documentation

type Parser n a = Parser (Tok n) a

A parser of core language tokens.

data Context n :: * -> *

Configuration and information from the context. Used for context sensitive parsing.

context :: Context Name Source

Starting context for the parser. Holds flags about what language features we should accept.

Modules

pModule :: Context Name -> Parser Name (Module (Annot SP)) Source

Parse a source tetra module.

Expressions

pExp :: Context Name -> Parser Name (Exp SP) Source

Parse a Tetra Source language expression.

pExpAtom :: Context Name -> Parser Name (Exp SP) Source

Parse a variable, constructor or parenthesised expression.

Types

pType :: Ord n => Context n -> Parser n (Type n)

Parse a type.

pTypeApp :: Ord n => Context n -> Parser n (Type n)

Parse a type application.

pTypeAtom :: Ord n => Context n -> Parser n (Type n)

Parse a variable, constructor or parenthesised type.

Witnesses

pWitness :: Ord n => Context n -> Parser n (Witness SourcePos n)

Parse a witness expression.

pWitnessApp :: Ord n => Context n -> Parser n (Witness SourcePos n)

Parse a witness application.

pWitnessAtom :: Ord n => Context n -> Parser n (Witness SourcePos n)

Parse a variable, constructor or parenthesised witness.

Constructors

pCon :: Eq (Tok n) => ParsecT [Token (Tok n)] (ParserState (Tok n)) Identity n

Parse a constructor name.

pLit :: Eq (Tok n) => ParsecT [Token (Tok n)] (ParserState (Tok n)) Identity n

Parse a literal.

Variables

pBinder :: (Ord n, Eq (Tok n)) => ParsecT [Token (Tok n)] (ParserState (Tok n)) Identity (Binder n)

Parse a binder.

pIndex :: Eq (Tok n) => ParsecT [Token (Tok n)] (ParserState (Tok n)) Identity Int

Parse a deBruijn index.

pVar :: Eq (Tok n) => ParsecT [Token (Tok n)] (ParserState (Tok n)) Identity n

Parse a variable.

pName :: Eq (Tok n) => ParsecT [Token (Tok n)] (ParserState (Tok n)) Identity n

Parse a constructor or variable name.

Raw Tokens

pTok :: TokAtom -> Parser n ()

Parse an atomic token.

pTokAs :: TokAtom -> a -> Parser n a

Parse an atomic token and return some value.