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

Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Cfg.FreeCfg

Description

The free Cfg

Synopsis

Documentation

data FreeCfg t nt Source

Represents a context-free grammar with its nonterminal and terminal types. The canonical instance of Cfg: a record that collects up implementations of each class method.

Constructors

FreeCfg 

Fields

nonterminals' :: Set nt

the nonterminals of the grammar

terminals' :: Set t

the terminals of the grammar

productionRules' :: nt -> Set (Vs t nt)

the productions of the grammar

startSymbol' :: nt

the start symbol of the grammar; must be an element of nonterminals cfg

Instances

Cfg FreeCfg t nt 

toFreeCfg :: Cfg cfg t nt => cfg t nt -> FreeCfg t nt Source

Converts any Cfg into a FreeCfg.