context-free-grammar-0.0.1: Basic algorithms on context-free grammars

Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Cfg.Augment

Contents

Description

Augmented grammars.

Synopsis

Augmenting grammars

augmentCfg :: forall cfg t nt. (Cfg cfg t nt, Ord nt, Ord t) => cfg t nt -> FreeCfg (AugT t) (AugNT nt) Source

Returns the augmented grammar: a grammar for the same language but using explicit start and end-of-file symbols.

Augmenting symbols

data AugNT nt Source

Nonterminal symbols augmented with a special StartSymbol

Constructors

StartSymbol 
AugNT nt 

Instances

Eq nt => Eq (AugNT nt) 
Ord nt => Ord (AugNT nt) 
Show nt => Show (AugNT nt) 

data AugT t Source

Terminal symbols augmented with a special end-of-file symbol

Constructors

EOF 
AugT t 

Instances

Eq t => Eq (AugT t) 
Ord t => Ord (AugT t) 
Show t => Show (AugT t) 

Type synonyms

type AugV t nt = V (AugT t) (AugNT nt) Source

A convenience synonym for an augmented vocabulary symbol

type AugVs t nt = Vs (AugT t) (AugNT nt) Source

A convenience synonym for augmented vocabulary symbols

type AugProduction t nt = Production (AugT t) (AugNT nt) Source

A convenience synonym for augmented productions

type AugFreeCfg t nt = FreeCfg (AugT t) (AugNT nt) Source

A convenience symbol for an augmented grammar