32 template <
class TerminalSymbolType,
class NonterminalSymbolType >
36template <
class TerminalSymbolType,
class NonterminalSymbolType >
43 for(
const auto & nonterminalSymbol :
grammar.getNonterminalAlphabet() ) {
52 for(
const auto & rule :
grammar.getRules( ) ) {
53 const NonterminalSymbolType& lhs = rule.first;
55 for (
const auto & ruleRHS : rule.second ) {
60 rrg.
addRule( rhs.first, std::move ( rightSide ) );
62 if ( lhs ==
grammar.getInitialSymbol ( ) )
63 rrg.
addRule ( rhs.first, rhs.second );
65 const TerminalSymbolType & rhs = ruleRHS.template get < TerminalSymbolType > ( );
70 if ( lhs ==
grammar.getInitialSymbol ( ) )
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Left regular grammar in Chomsky hierarchy or type 3 in Chomsky hierarchy. Generates regular languages...
Definition: LeftRG.h:70
Right regular grammar in Chomsky hierarchy or type 3 in Chomsky hierarchy. Generates regular language...
Definition: RightRG.h:70
void setGeneratesEpsilon(bool genEps)
Definition: RightRG.h:404
bool addNonterminalSymbol(NonterminalSymbolType symbol)
Definition: RightRG.h:218
bool addRule(NonterminalSymbolType leftHandSide, ext::variant< TerminalSymbolType, ext::pair< TerminalSymbolType, NonterminalSymbolType > > rightHandSide)
Add a new rule of a grammar.
Definition: RightRG.h:333
void setTerminalAlphabet(ext::set< TerminalSymbolType > symbols)
Definition: RightRG.h:265
const NonterminalSymbolType & getInitialSymbol() const &
Definition: RightRG.h:169
Definition: ToGrammarRightRG.h:20
static grammar::RightRG< TerminalSymbolType, NonterminalSymbolType > convert(const grammar::LeftRG< TerminalSymbolType, NonterminalSymbolType > &grammar)
Definition: ToGrammarRightRG.h:37
T createUnique(T object, const Alphabets &... alphabets)
Definition: createUnique.hpp:46
Definition: converterCommon.hpp:8
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
Definition: ToAutomaton.h:24