|
TuringSim
C++ framework to simulate abstract computing models
|
3 #include <memory/word.h>
4 #include <memory/stack.h>
5 #include <transition/PDM/pushdownMachineTransition.h>
17 typename StackSymbolType_
31 static_assert(std::is_same_v<StateType, StateType_>);
32 static_assert(std::is_same_v<ApplyHelperType, std::monostate>);
64 return this->
matchFromCurrentLetter(state, std::get<WordType>(storage).front_opt(), std::get<StackType>(storage).top_opt());
75 virtual std::optional<ApplyHelperType>
matchFromCurrentLetter(
const StateType& state,
const std::optional<LetterType>& letter,
const std::optional<StackSymbolType>& symbol)
const {
76 if(state == preState && letter && symbol && *letter == preLetter && *symbol == preSymbol) {
77 return {std::monostate{}};
82 #pragma clang diagnostic push
83 #pragma clang diagnostic ignored "-Wunused-parameter"
97 std::get<StackType>(storage).pop();
98 std::get<StackType>(storage).pushs(postSymbols);
99 std::get<WordType>(storage).read();
102 #pragma clang diagnostic pop
109 std::vector<StackSymbolType> postSymbols;
StorageType_ StorageType
The type of storage.
StackSymbolType_ StackSymbolType
The type of symbols in the stack.
virtual std::optional< ApplyHelperType > match(const StateType &state, const StorageType &storage) const override final
Test whether the transition matches a configuration. Returned optional is empty iff the transition do...
virtual std::optional< ApplyHelperType > matchFromCurrentLetter(const StateType &state, const std::optional< LetterType > &letter, const std::optional< StackSymbolType > &symbol) const
Test whether the transition matches a configuration. Returned optional is empty iff the transition do...
StateType_ StateType
The type of states.
SimplePushdownMachineTransition(const SimplePushdownMachineTransition &)=default
The default copy constructor.
LetterType_ LetterType
The type of letter of the word.
virtual ~SimplePushdownMachineTransition()=default
The default virtual destructor.
ApplyHelperType_ ApplyHelperType
The type of apply helpers.
SimplePushdownMachineTransition & operator=(SimplePushdownMachineTransition &&)=default
The default move assignment operator.
StackSymbolType_ StackSymbolType
The type of symbols in the stack.
Memory::Stack::Stack< StackSymbolType_ > StackType
The type of the stack of a machine with such transition.
Transition of pushdown machines, i.e. transition on a word and a stack.
LetterType_ LetterType
The type of letter of the word.
virtual StateType apply(const StateType &state, StorageType &storage, ApplyHelperType &&helper, bool &running) const override final
Apply a previously matching transition and return the new state.
SimplePushdownMachineTransition & operator=(const SimplePushdownMachineTransition &)=default
The default copy assignment operator.
Transition of pushdown machines, i.e. transition on a word and a stack.
StateType_ StateType
The type of states.
SimplePushdownMachineTransition(SimplePushdownMachineTransition &&)=default
The default move constructor.
SimplePushdownMachineTransition()=default
The default constructor.
Memory::Word::Word< LetterType_ > WordType
The type of words read by a machine with such transition.
Transitions for pushdown machines.