10#include <alib/variant>
20 template <
class TerminalSymbolType,
class NonterminalSymbolType >
23 template <
class TerminalSymbolType,
class NonterminalSymbolType >
27 template <
class T,
class TerminalSymbolType =
typename grammar::TerminalSymbolTypeOfGrammar < T >,
class NonterminalSymbolType =
typename grammar::NonterminalSymbolTypeOfGrammar < T > >
30 template <
class T,
class TerminalSymbolType =
typename grammar::TerminalSymbolTypeOfGrammar < T >,
class NonterminalSymbolType =
typename grammar::NonterminalSymbolTypeOfGrammar < T > >
34template <
class TerminalSymbolType,
class NonterminalSymbolType >
37 if ( rhs.empty ( ) ) {
42 else if ( terminals.count ( rhs[0] ) ) {
48 return firstOfNonterminal.find ( rhs[0] )->second;
64template <
class TerminalSymbolType,
class NonterminalSymbolType >
76 for (
const NonterminalSymbolType & nonterminal : nonterminals )
77 firstOfNonterminal1[nonterminal];
85 firstOfNonterminal2[rule.first].
insert ( newFirst.
begin ( ), newFirst.
end ( ) );
88 if ( firstOfNonterminal1 == firstOfNonterminal2 )
91 firstOfNonterminal1 = std::move ( firstOfNonterminal2 );
92 firstOfNonterminal2.clear ( );
96 return firstOfNonterminal1;
99template <
class T,
class TerminalSymbolType,
class NonterminalSymbolType >
114template <
class T,
class TerminalSymbolType,
class NonterminalSymbolType >
120 return first (
grammar.getTerminalAlphabet ( ),
grammar.getNonterminalAlphabet ( ), firstNt, rhs );
Basic exception from which all other exceptions are derived.
Definition: CommonException.h:21
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
std::pair< iterator, bool > insert(const T &key, const R &value)
Insert variant with explicit key and value parameters.
Definition: map.hpp:118
auto begin() &
Inherited behavior of begin for non-const instance.
Definition: set.hpp:99
auto end() &
Inherited behavior of end for non-const instance.
Definition: set.hpp:129
Implementation of the variant class allowing to store any type of those listed in the template parame...
Definition: variant.hpp:98
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
static ext::map< NonterminalSymbolType, ext::set< ext::vector< ext::variant< TerminalSymbolType, NonterminalSymbolType > > > > getRawRules(const LG< TerminalSymbolType, NonterminalSymbolType > &grammar)
Definition: RawRules.h:92
return res
Definition: MinimizeByPartitioning.h:145
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
Definition: ToAutomaton.h:24