SyntaxMacros-0.1: Syntax Macros in the form of an EDSL

Language.Grammars.SyntaxMacros

Documentation

type ExtGram env nts = GramTrafo env () (nts env)Source

type SyntaxMacro env nts nts' = GramTrafo env (nts env) (nts' env)Source

data Export start nts env Source

Constructors

Export (Symbol start env) (nts env) 

addNT :: GramTrafo env [Prod a env] (Symbol a env)Source

addProds :: GramTrafo env (Symbol a env, [Prod a env]) ()Source

closeGram :: (forall env. ExtGram env (Export a nts)) -> Grammar aSource

extendGram :: (NTRecord (nts env), NTRecord (nts' env)) => ExtGram env (Export start nts) -> SyntaxMacro env (Export start nts) (Export start' nts') -> ExtGram env (Export start' nts')Source

exportNTs :: NTRecord (nts env) => GramTrafo env (Export start nts env) (Export start nts env)Source

newtype NTField nt a env Source

Constructors

NTField 

Fields

symbolNTField :: Symbol a env
 

labelNTField :: NTField nt a env -> ntSource

data NTCons nt v l env Source

Constructors

NTCons (NTField nt v env) (l env) 

Instances

NotDuplicated nt1 (l env) => NotDuplicated nt1 (NTCons nt2 v l env) 
Fail (Duplicated nt) => NotDuplicated nt (NTCons nt v l env) 
GetNT nt1 (l env) r => GetNT nt1 (NTCons nt2 v l env) r 
GetNT nt (NTCons nt v l env) (Symbol v env) 
(NTRecord (l env), NotDuplicated nt (l env)) => NTRecord (NTCons nt v l env) 

data NTNil env Source

Constructors

NTNil 

Instances

NotDuplicated nt (NTNil env) 
Fail (NotFound nt) => GetNT nt (NTNil env) r 
NTRecord (NTNil env) 

class NTRecord r Source

Instances

NTRecord (NTNil env) 
(NTRecord (l env), NotDuplicated nt (l env)) => NTRecord (NTCons nt v l env) 

class Fail err Source

class NotDuplicated nt r Source

Instances

NotDuplicated nt (NTNil env) 
NotDuplicated nt1 (l env) => NotDuplicated nt1 (NTCons nt2 v l env) 
Fail (Duplicated nt) => NotDuplicated nt (NTCons nt v l env) 

(^=) :: nt -> Symbol a env -> NTField nt a envSource

(^|) :: NTRecord (NTCons nt a l env) => NTField nt a env -> l env -> NTCons nt a l envSource

class GetNT nt r v | nt r -> v whereSource

Methods

getNT :: nt -> r -> vSource

Instances

Fail (NotFound nt) => GetNT nt (NTNil env) r 
GetNT nt1 (l env) r => GetNT nt1 (NTCons nt2 v l env) r 
GetNT nt (NTCons nt v l env) (Symbol v env) 

newtype Const f a s Source

Constructors

C 

Fields

unC :: f a
 

mapEnv :: (forall a. f a s -> g a s) -> Env f s env -> Env g s envSource

data ParseResult a Source

Constructors

Ok a 
Rep a [ParseMsg] 

Instances

Show a => Show (ParseResult a) 

rparse :: Parser Token a -> [Token] -> (a, [ParseMsg])Source