Context-Free Grammar Definitions #
This file defines context-free grammars, their derivation relation, and the induced language predicate.
Main declarations #
One step of context-free transformation.
Equations
Instances For
Any number of steps of context-free transformation; reflexive+transitive closure of CF_transforms.
Equations
Instances For
Accepts a string (a List of symbols) iff it can be derived from the initial nonterminal.
Equations
- CF_generates_str g s = CF_derives g [symbol.nonterminal g.initial] s
Instances For
Accepts a word (a List of terminals) iff it can be derived from the initial nonterminal.
Equations
- CF_generates g w = CF_generates_str g (List.map symbol.terminal w)
Instances For
The Set of words that can be derived from the initial nonterminal.
Equations
- CF_language g = setOf (CF_generates g)