3 #include <machine/PDM/simplePushdownMachine.h>
4 #include <transition/PDM/simplePushdownMachineTransition.h>
23 typename StackSymbolType,
44 typename StackSymbolType_,
55 :
public SimplePushdownMachine<StateType_, LetterType_, StackSymbolType_, true, acceptingStyle, std::set, std::set>{
59 using typename SimplePushdownMachine_::WordType;
60 using typename SimplePushdownMachine_::StackType;
61 using typename SimplePushdownMachine_::StateType;
62 using typename SimplePushdownMachine_::LetterType;
63 using typename SimplePushdownMachine_::IsAccepting;
64 using typename SimplePushdownMachine_::StorageType;
65 using typename SimplePushdownMachine_::IsAlternating;
66 using typename SimplePushdownMachine_::TransitionType;
67 using typename SimplePushdownMachine_::ApplyHelperType;
68 using typename SimplePushdownMachine_::IsDeterministic;
69 using typename SimplePushdownMachine_::StackSymbolType;
70 using typename SimplePushdownMachine_::TransitionContainer;
71 using typename SimplePushdownMachine_::InitialStateContainer;
72 using typename SimplePushdownMachine_::OptionalHelpedTransition;
74 static_assert(std::is_same_v<StateType, typename TransitionType::StateType>);
75 static_assert(std::is_same_v<StorageType, typename TransitionType::StorageType>);
76 static_assert(std::is_same_v<TransitionType, TransitionType_>);
77 static_assert(std::is_same_v<ApplyHelperType, typename TransitionType::ApplyHelperType>);
78 static_assert(std::is_same_v<ApplyHelperType, std::monostate>);
79 static_assert(std::is_same_v<IsDeterministic, std::true_type>);
80 static_assert(std::is_same_v<TransitionContainer, std::set<std::pair<const TransitionType&, ApplyHelperType>>>);
81 static_assert(std::is_same_v<InitialStateContainer, std::set<StateType>>);
82 static_assert(std::is_same_v<OptionalHelpedTransition, std::optional<std::pair<const TransitionType&, ApplyHelperType>>>);
85 "StorageType should be a word and a stack.");
86 static_assert(std::is_same_v<TransitionType_, TransitionType>,
87 "TransitionType must be SimplePushdownTransition");
89 "The only valid value for AcceptingConstructorArgs is the default parameter.");
100 const StateType& initialState,
101 const std::vector<TransitionType>& transitions,
102 Args... acceptingArgs
105 initialState(initialState),
108 for(
const TransitionType& transition: transitions) {
109 this->transitions[transition.getPreState()].insert({transition.getPreLetter(), transition});
155 return {{transitions.at(state).at(letter.value()).at(stack.top()), std::monostate()}};
157 catch(std::out_of_range) {
160 catch(std::bad_optional_access) {
175 std::map<StateType, std::map<LetterType, std::map<StackSymbolType, TransitionType>>>
transitions;