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

Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Cfg.Reachable

Description

Reachability of nonterminals in the grammar.

Synopsis

Documentation

reachables :: forall cfg t nt. (Cfg cfg t nt, Ord nt) => cfg t nt -> Set nt Source

Returns the nonterminals of this grammar reachable from the start symbol.

unreachables :: forall cfg t nt. (Cfg cfg t nt, Ord nt) => cfg t nt -> Set nt Source

Returns the nonterminals of this grammar unreachable from the start symbol.

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

Returns an equivalent grammar not including unreachable nonterminals.