|
TuringSim
C++ framework to simulate abstract computing models
|
3 #include <state/mConfiguration/mConfigurationParser.h>
4 #include <transition/Turing/turingStyleInstructionListParser.h>
5 #include <symbol/turingStyleMixedSymbolPatternParser.h>
6 #include <transition/Turing/turingStyleMConfigurationTuringMachineTransition.h>
14 template <
bool isHalfTape = false>
32 static_assert(std::is_same_v<NodeStateType, std::string>);
50 const std::vector<Instruction>& instructions,
72 const std::string& preStatePatternString,
73 const std::string& preSymbolPatternString,
74 const std::string& instructionsString,
75 const std::string& symbolPlaceHolder,
76 const std::string& postStatePatternString
79 State::MConfiguration::MConfigurationParser{}.parse(preStatePatternString),
81 TuringStyleInstructionListParser<isHalfTape>{}.parse(instructionsString),
93 State::MConfiguration::MConfigurationParser{}.parse(t[0]),
95 TuringStyleInstructionListParser<isHalfTape>{}.parse(t[2]),
MConfigurationTuringMachineTransitionApplyHelper< std::string > ApplyHelperType
The type of apply helpers.
virtual ~StringTuringStyleMConfigurationTuringMachineTransition() override=default
The default virtual destructor.
The base class for m-configurations.
Symbol::TuringStyleMixedSymbolPattern< T > SymbolPattern
The type of symbol patterns.
An instruction that writes a single symbol identified by a key in a substitution.
Transitions for Turing machines.
std::integral_constant< bool, hasHalfTape > HasHalfTape
Whether the tape is a half-tape or a full tape.
A parser of mixed symbol pattern where symbols are std::string
StringTuringStyleMConfigurationTuringMachineTransition(StringTuringStyleMConfigurationTuringMachineTransition &&)=default
The default move constructor.
std::shared_ptr< const State::MConfiguration::MConfiguration< T > > StateType
The type of states.
MConfigurationTuringMachineTransitionApplyHelper< T > ApplyHelperType
The type of apply helpers.
ApplyHelperType SubstitutionType
The type of substitutions, same as apply helper.
StorageType_::Movement Movement
The type of movement on the tape.
StringTuringStyleMConfigurationTuringMachineTransition(const StringTuringStyleMConfigurationTuringMachineTransition &)=default
The default copy constructor.
Parse a m-configuration written as a std::string into a MConfiguration<std::string>.
StringTuringStyleMConfigurationTuringMachineTransition(const std::array< std::string, 5 > &t)
Same as StringTuringStyleMConfigurationTuringMachineTransition(const std::string& preStatePatternStri...
StringTuringStyleMConfigurationTuringMachineTransition(const State::MConfiguration::MConfiguration< NodeStateType > &preStatePattern, const SymbolPattern &preSymbolPattern, const std::vector< Instruction > &instructions, const NodeStateType &symbolPlaceHolder, const State::MConfiguration::MConfiguration< NodeStateType > &postStatePattern)
Regular constructor.
StringTuringStyleMConfigurationTuringMachineTransition & operator=(StringTuringStyleMConfigurationTuringMachineTransition &&)=default
The default move assignment operator.
StringTuringStyleMConfigurationTuringMachineTransition(const std::string &preStatePatternString, const std::string &preSymbolPatternString, const std::string &instructionsString, const std::string &symbolPlaceHolder, const std::string &postStatePatternString)
Regular constructor, but use default parsers to parse each field (except symbolPlaceHolder).
MConfigurationTuringMachineTransition_::Instruction ConstantInstruction
The type of instructions we can run without context. Dynamic instruction will be translated to consta...
Transitions as we find in 1936 Turing's paper, where nodes are std::string.
SymbolPattern parse(const std::string &pattern) const
Parse a string into a symbol pattern. The usual entry point.
Transitions as we find in 1936 Turing's paper.
StorageType_ StorageType
The type of storage.
T SymbolType
The type of symbols on the tape.
StringTuringStyleMConfigurationTuringMachineTransition & operator=(const StringTuringStyleMConfigurationTuringMachineTransition &)=default
The default copy assignment operator.
std::variant< ConstantInstruction, DynamicWrite > Instruction
Either a constant instruction that can be executed without context, or a dynamic instruction (dynamic...
T NodeStateType
The type of the nodes in the m-configurations.
std::shared_ptr< const MConfiguration< std::string > > parse(const std::string &mConfiguration) const
Parse a string into a m-configuration. The usual entry point.
StringTuringStyleMConfigurationTuringMachineTransition()=delete
Build a StringTuringStyleMConfigurationTuringMachineTransition from nothing is meaningless.