Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
GrammarCompare.h
Go to the documentation of this file.
1
6#pragma once
7
21
22namespace compare {
23
25public:
26 template < class SymbolType >
28
29 template < class SymbolType >
31
32 template < class SymbolType >
34
35 template < class SymbolType >
37
38 template < class SymbolType >
39 static bool compare(const grammar::LG < SymbolType > & a, const grammar::LG < SymbolType > & b);
40
41 template < class SymbolType >
42 static bool compare(const grammar::CFG < SymbolType > & a, const grammar::CFG < SymbolType > & b);
43
44 template < class SymbolType >
46
47 template < class SymbolType >
48 static bool compare(const grammar::CNF < SymbolType > & a, const grammar::CNF < SymbolType > & b);
49
50 template < class SymbolType >
51 static bool compare(const grammar::GNF < SymbolType > & a, const grammar::GNF < SymbolType > & b);
52
53 template < class SymbolType >
54 static bool compare(const grammar::CSG < SymbolType > & a, const grammar::CSG < SymbolType > & b);
55
56 template < class SymbolType >
58
59 template < class SymbolType >
61
62 template < class SymbolType >
64};
65
66template < class SymbolType >
69 a.getRules() == b.getRules() &&
70// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
72}
73
74template < class SymbolType >
77 a.getRules() == b.getRules() &&
78// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
80}
81
82template < class SymbolType >
85 a.getRules() == b.getRules() &&
86// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
88}
89
90template < class SymbolType >
93 a.getRules() == b.getRules() &&
94// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
96}
97
98template < class SymbolType >
101 a.getRules() == b.getRules() &&
102// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
104}
105
106template < class SymbolType >
109 a.getRules() == b.getRules() &&
110// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
112}
113
114template < class SymbolType >
117 a.getRules() == b.getRules() &&
118// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
120}
121
122template < class SymbolType >
125 a.getRules() == b.getRules() &&
126// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
128}
129
130template < class SymbolType >
133 a.getRules() == b.getRules() &&
134// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
136}
137
138template < class SymbolType >
141 a.getRules() == b.getRules() &&
142// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
144}
145
146template < class SymbolType >
149 a.getRules() == b.getRules() &&
150// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
152}
153
154template < class SymbolType >
157 a.getRules() == b.getRules() &&
158// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
160}
161
162template < class SymbolType >
165 a.getRules() == b.getRules() &&
166// a.getTerminalAlphabet() == b.getTerminalAlphabet() &&
168}
169
170} /* namespace compare */
171
Definition: GrammarCompare.h:24
static bool compare(const grammar::LeftLG< SymbolType > &a, const grammar::LeftLG< SymbolType > &b)
Definition: GrammarCompare.h:67
Context free grammar in Chomsky hierarchy or type 2 in Chomsky hierarchy. Generates context free lang...
Definition: CFG.h:67
const NonterminalSymbolType & getInitialSymbol() const &
Definition: CFG.h:148
const ext::set< NonterminalSymbolType > & getNonterminalAlphabet() const &
Definition: CFG.h:177
const ext::map< NonterminalSymbolType, ext::set< ext::vector< ext::variant< TerminalSymbolType, NonterminalSymbolType > > > > & getRules() const &
Definition: CFG.h:332
Chomsky normal form of a context free grammar in Chomsky hierarchy or type 2 in Chomsky hierarchy....
Definition: CNF.h:66
const NonterminalSymbolType & getInitialSymbol() const &
Definition: CNF.h:165
const ext::map< NonterminalSymbolType, ext::set< ext::variant< TerminalSymbolType, ext::pair< NonterminalSymbolType, NonterminalSymbolType > > > > & getRules() const &
Definition: CNF.h:373
const ext::set< NonterminalSymbolType > & getNonterminalAlphabet() const &
Definition: CNF.h:194
Context sensitive grammar in Chomsky hierarchy or type 1 in Chomsky hierarchy. Generates context sens...
Definition: CSG.h:64
const ext::set< SymbolType > & getNonterminalAlphabet() const &
Definition: CSG.h:178
const SymbolType & getInitialSymbol() const &
Definition: CSG.h:149
const ext::map< ext::tuple< ext::vector< SymbolType >, SymbolType, ext::vector< SymbolType > >, ext::set< ext::vector< SymbolType > > > & getRules() const &
Definition: CSG.h:363
Context preserving unrestricted grammar. Type 0 in Chomsky hierarchy. Generates recursively enumerabl...
Definition: ContextPreservingUnrestrictedGrammar.h:64
const ext::map< ext::tuple< ext::vector< SymbolType >, SymbolType, ext::vector< SymbolType > >, ext::set< ext::vector< SymbolType > > > & getRules() const &
Definition: ContextPreservingUnrestrictedGrammar.h:334
const ext::set< SymbolType > & getNonterminalAlphabet() const &
Definition: ContextPreservingUnrestrictedGrammar.h:173
const SymbolType & getInitialSymbol() const &
Definition: ContextPreservingUnrestrictedGrammar.h:144
Context free grammar without epsilon rules in Chomsky hierarchy or type 2 in Chomsky hierarchy....
Definition: EpsilonFreeCFG.h:65
const ext::set< NonterminalSymbolType > & getNonterminalAlphabet() const &
Definition: EpsilonFreeCFG.h:173
const NonterminalSymbolType & getInitialSymbol() const &
Definition: EpsilonFreeCFG.h:144
const ext::map< NonterminalSymbolType, ext::set< ext::vector< ext::variant< TerminalSymbolType, NonterminalSymbolType > > > > & getRules() const &
Definition: EpsilonFreeCFG.h:340
Greibach normal form of a context free grammar in Chomsky hierarchy or type 2 in Chomsky hierarchy....
Definition: GNF.h:65
const ext::map< NonterminalSymbolType, ext::set< ext::pair< TerminalSymbolType, ext::vector< NonterminalSymbolType > > > > & getRules() const &
Definition: GNF.h:339
const NonterminalSymbolType & getInitialSymbol() const &
Definition: GNF.h:144
const ext::set< NonterminalSymbolType > & getNonterminalAlphabet() const &
Definition: GNF.h:173
Context free grammar in Chomsky hierarchy or type 2 in Chomsky hierarchy. Generates context free lang...
Definition: LG.h:67
const NonterminalSymbolType & getInitialSymbol() const &
Definition: LG.h:161
const ext::set< NonterminalSymbolType > & getNonterminalAlphabet() const &
Definition: LG.h:190
const ext::map< NonterminalSymbolType, ext::set< ext::variant< ext::vector< TerminalSymbolType >, ext::tuple< ext::vector< TerminalSymbolType >, NonterminalSymbolType, ext::vector< TerminalSymbolType > > > > > & getRules() const &
Definition: LG.h:370
Left linear grammar in Chomsky hierarchy or type 3 in Chomsky hierarchy. Generates regular languages.
Definition: LeftLG.h:66
const NonterminalSymbolType & getInitialSymbol() const &
Definition: LeftLG.h:160
const ext::set< NonterminalSymbolType > & getNonterminalAlphabet() const &
Definition: LeftLG.h:189
const ext::map< NonterminalSymbolType, ext::set< ext::variant< ext::vector< TerminalSymbolType >, ext::pair< NonterminalSymbolType, ext::vector< TerminalSymbolType > > > > > & getRules() const &
Definition: LeftLG.h:359
Left regular grammar in Chomsky hierarchy or type 3 in Chomsky hierarchy. Generates regular languages...
Definition: LeftRG.h:70
const ext::map< NonterminalSymbolType, ext::set< ext::variant< TerminalSymbolType, ext::pair< NonterminalSymbolType, TerminalSymbolType > > > > & getRules() const &
Definition: LeftRG.h:376
const NonterminalSymbolType & getInitialSymbol() const &
Definition: LeftRG.h:169
const ext::set< NonterminalSymbolType > & getNonterminalAlphabet() const &
Definition: LeftRG.h:198
Noncontracting grammar in Chomsky hierarchy or type 1 in Chomsky hierarchy. Generates context sensiti...
Definition: NonContractingGrammar.h:64
const ext::set< SymbolType > & getNonterminalAlphabet() const &
Definition: NonContractingGrammar.h:172
const ext::map< ext::vector< SymbolType >, ext::set< ext::vector< SymbolType > > > & getRules() const &
Definition: NonContractingGrammar.h:360
const SymbolType & getInitialSymbol() const &
Definition: NonContractingGrammar.h:143
Right linear grammar in Chomsky hierarchy or type 3 in Chomsky hierarchy. Generates regular languages...
Definition: RightLG.h:65
const ext::map< NonterminalSymbolType, ext::set< ext::variant< ext::vector< TerminalSymbolType >, ext::pair< ext::vector< TerminalSymbolType >, NonterminalSymbolType > > > > & getRules() const &
Definition: RightLG.h:356
const NonterminalSymbolType & getInitialSymbol() const &
Definition: RightLG.h:159
const ext::set< NonterminalSymbolType > & getNonterminalAlphabet() const &
Definition: RightLG.h:188
Right regular grammar in Chomsky hierarchy or type 3 in Chomsky hierarchy. Generates regular language...
Definition: RightRG.h:70
const ext::map< NonterminalSymbolType, ext::set< ext::variant< TerminalSymbolType, ext::pair< TerminalSymbolType, NonterminalSymbolType > > > > & getRules() const &
Definition: RightRG.h:375
const ext::set< NonterminalSymbolType > & getNonterminalAlphabet() const &
Definition: RightRG.h:198
const NonterminalSymbolType & getInitialSymbol() const &
Definition: RightRG.h:169
Unrestricted grammar. Type 0 in Chomsky hierarchy. Generates recursively enumerable languages.
Definition: UnrestrictedGrammar.h:64
const ext::map< ext::vector< SymbolType >, ext::set< ext::vector< SymbolType > > > & getRules() const &
Definition: UnrestrictedGrammar.h:330
const SymbolType & getInitialSymbol() const &
Definition: UnrestrictedGrammar.h:144
const ext::set< SymbolType > & getNonterminalAlphabet() const &
Definition: UnrestrictedGrammar.h:173
Definition: AutomatonCompare.h:29