context-free-grammar-0.1.1: Basic algorithms on context-free grammars
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Cfg.Augment

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

Instances details
Eq nt => Eq (AugNT nt) Source # 
Instance details

Defined in Data.Cfg.Augment

Methods

(==) :: AugNT nt -> AugNT nt -> Bool #

(/=) :: AugNT nt -> AugNT nt -> Bool #

Ord nt => Ord (AugNT nt) Source # 
Instance details

Defined in Data.Cfg.Augment

Methods

compare :: AugNT nt -> AugNT nt -> Ordering #

(<) :: AugNT nt -> AugNT nt -> Bool #

(<=) :: AugNT nt -> AugNT nt -> Bool #

(>) :: AugNT nt -> AugNT nt -> Bool #

(>=) :: AugNT nt -> AugNT nt -> Bool #

max :: AugNT nt -> AugNT nt -> AugNT nt #

min :: AugNT nt -> AugNT nt -> AugNT nt #

Show nt => Show (AugNT nt) Source # 
Instance details

Defined in Data.Cfg.Augment

Methods

showsPrec :: Int -> AugNT nt -> ShowS #

show :: AugNT nt -> String #

showList :: [AugNT nt] -> ShowS #

data AugT t Source #

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

Constructors

EOF 
AugT t 

Instances

Instances details
Eq t => Eq (AugT t) Source # 
Instance details

Defined in Data.Cfg.Augment

Methods

(==) :: AugT t -> AugT t -> Bool #

(/=) :: AugT t -> AugT t -> Bool #

Ord t => Ord (AugT t) Source # 
Instance details

Defined in Data.Cfg.Augment

Methods

compare :: AugT t -> AugT t -> Ordering #

(<) :: AugT t -> AugT t -> Bool #

(<=) :: AugT t -> AugT t -> Bool #

(>) :: AugT t -> AugT t -> Bool #

(>=) :: AugT t -> AugT t -> Bool #

max :: AugT t -> AugT t -> AugT t #

min :: AugT t -> AugT t -> AugT t #

Show t => Show (AugT t) Source # 
Instance details

Defined in Data.Cfg.Augment

Methods

showsPrec :: Int -> AugT t -> ShowS #

show :: AugT t -> String #

showList :: [AugT t] -> ShowS #

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