14namespace determinize {
16template <
class InputSymbolType,
class PushdownStoreSymbolType,
class StateType >
21 if ( dSubSet.contains ( std::get < 0 > ( transition.first ) ) )
22 ret.insert(std::get<1>(transition.first));
27template <
class InputSymbolType,
class PushdownStoreSymbolType,
class StateType >
32 if ( dSubSet.contains ( transition.first.first ) )
33 call.insert(transition.first.second);
38template <
class InputSymbolType,
class PushdownStoreSymbolType,
class StateType >
43 if ( dSubSet.contains ( transition.first.first ) )
44 local.insert(transition.first.second);
49template <
class InputSymbolType,
class PushdownStoreSymbolType,
class StateType >
63 std::queue < DeterministicStateType > dirtyStates;
64 dirtyStates.push ( initialLabel );
66 std::queue < ext::pair<DeterministicStateType, DeterministicPushdownStoreSymbolType> > dirtyStateSymbols;
67 dirtyStateSymbols.push (
ext::make_pair ( initialLabel, bottom ) );
69 while ( ! dirtyStateSymbols.empty ( ) || ! dirtyStates.empty ( ) ) {
70 if ( ! dirtyStateSymbols.empty ( ) ) {
71 DeterministicStateType state = std::move ( dirtyStateSymbols.front ( ).first );
72 DeterministicPushdownStoreSymbolType pdaSymbol = std::move ( dirtyStateSymbols.front ( ).second );
74 dirtyStateSymbols.pop ( );
82 DeterministicStateType to;
84 if ( pdaSymbol == dpda.getBottomOfTheStackSymbol ( ) )
87 to =
ret ( state, pdaSymbol, input, npda );
92 if ( dpda.addState ( to ) )
93 dirtyStates.push ( to );
95 localClosure [ pdaSymbol.first ].
insert ( to );
97 updateTopSymbols ( localClosure, topSymbols, dirtyStateSymbols, to, topSymbols [ pdaSymbol.first ] );
99 dpda.addReturnTransition ( state, std::move ( input ), pdaSymbol, std::move ( to ) );
102 DeterministicStateType state = std::move ( dirtyStates.front ( ) );
113 DeterministicStateType to = local ( state, input, npda );
118 if ( dpda.addState ( to ) )
119 dirtyStates.push ( to );
121 localClosure [ state ].
insert ( to );
123 updateTopSymbols ( localClosure, topSymbols, dirtyStateSymbols, to, topSymbols [ state ] );
125 dpda.addLocalTransition ( state, std::move ( input ), std::move ( to ) );
128 DeterministicStateType to =
call ( state, input, npda );
135 if ( dpda.addState ( to ) )
136 dirtyStates.push ( to );
138 updateTopSymbols ( localClosure, topSymbols, dirtyStateSymbols, to, { pdaSymbol } );
140 dpda.addPushdownStoreSymbol ( pdaSymbol );
141 dpda.addCallTransition ( state, std::move ( input ), std::move ( to ), std::move ( pdaSymbol ) );
147 for(
const DeterministicStateType & state : dpda.getStates()) {
151 dpda.addFinalState(state);
Deterministic real time height deterministic pushdown automaton. Accepts subset of context free langu...
Definition: RealTimeHeightDeterministicDPDA.h:89
Nondeterministic real time height deterministic pushdown automaton. Accepts subset of context free la...
Definition: RealTimeHeightDeterministicNPDA.h:76
const ext::set< StateType > & getInitialStates() const &
Definition: RealTimeHeightDeterministicNPDA.h:175
const ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, StateType > & getLocalTransitions() const &
Definition: RealTimeHeightDeterministicNPDA.h:1004
const ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, ext::pair< StateType, PushdownStoreSymbolType > > & getCallTransitions() const &
Definition: RealTimeHeightDeterministicNPDA.h:984
const ext::set< StateType > & getFinalStates() const &
Definition: RealTimeHeightDeterministicNPDA.h:224
const ext::multimap< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, PushdownStoreSymbolType >, StateType > & getReturnTransitions() const &
Definition: RealTimeHeightDeterministicNPDA.h:994
const ext::set< InputSymbolType > & getInputAlphabet() const &
Definition: RealTimeHeightDeterministicNPDA.h:360
static automaton::DFA< SymbolType, StateType > determinize(const automaton::DFA< SymbolType, StateType > &automaton)
Definition: Determinize.h:276
static bool verbose
Verbose flag. Some algorithms print additional runtime information about internal datastructures or t...
Definition: GlobalData.h:24
static ext::reference_wrapper< ext::ostream > log
Standard loging stream. Mapped to descriptor 4.
Definition: GlobalData.h:78
Definition: symbol_or_epsilon.hpp:24
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
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
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
void updateTopSymbols(ext::map< DeterministicStateType, ext::set< DeterministicStateType > > &localClosure, ext::map< DeterministicStateType, ext::set< DeterministicPushdownStoreSymbolType > > &topSymbols, std::queue< ext::pair< DeterministicStateType, DeterministicPushdownStoreSymbolType > > &dirtyStateSymbols, const DeterministicStateType &state, const ext::set< DeterministicPushdownStoreSymbolType > &newSymbols)
Definition: RHDPDACommon.h:126
ext::set< common::symbol_or_epsilon< InputSymbolType > > getCallPartitioning(const automaton::RealTimeHeightDeterministicNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &npda, const ext::set< StateType > &dSubSet)
Definition: DeterminizeRHDPDAPart.hxx:28
ext::set< ext::pair< StateType, StateType > > call(const ext::set< ext::pair< StateType, StateType > > &S, const InputSymbolType &input, const N &nondeterministic)
Definition: RHDPDACommon.h:94
ext::set< ext::pair< StateType, StateType > > ret(const ext::set< ext::pair< StateType, StateType > > &S, const DeterministicPushdownStoreSymbolType &pdaSymbol, const InputSymbolType &input, const N &nondeterministic)
Definition: RHDPDACommon.h:57
ext::set< ext::pair< StateType, StateType > > createIdentity(const ext::set< StateType > &states)
Definition: RHDPDACommon.h:30
ext::set< StateType > retrieveDSubSet(const ext::set< ext::pair< StateType, StateType > > &localOperation)
Definition: RHDPDACommon.h:21
ext::set< ext::pair< StateType, StateType > > retInitial(const ext::set< ext::pair< StateType, StateType > > &S, const InputSymbolType &input, const N &nondeterministic)
Definition: RHDPDACommon.h:39
ext::set< common::symbol_or_epsilon< InputSymbolType > > getLocalPartitioning(const automaton::RealTimeHeightDeterministicNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &npda, const ext::set< StateType > &dSubSet)
Definition: DeterminizeRHDPDAPart.hxx:39
ext::set< common::symbol_or_epsilon< InputSymbolType > > getRetPartitioning(const automaton::RealTimeHeightDeterministicNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &npda, const ext::set< StateType > &dSubSet)
Definition: DeterminizeRHDPDAPart.hxx:17
Definition: ToGrammar.h:31
reference_mover< T > make_mover(T ¶m)
Move adaptor construction function specialized to lvalue reference parameter.
Definition: iterator.hpp:468
bool excludes(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp)
Tests two sorted ranges wheter all elements from the second are not present in the first.
Definition: algorithm.hpp:46
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79