private TMConfigure TMConfig; // configuration of Turing Machine #endregion Fields #region Constructors //-------------------------------------------------------------------------------- // TMSourceCode() // In: - // Out: - // Description: initialisation of vars public TMSourceCode() { linesOfCode = new ArrayList(); TMCode = new ArrayList(); TMConfig = new TMConfigure(); TMCodeMatrix = new String[1, 1]; }
static void Main(string[] args) { int tmConfFlag = 0; int tmCodeFlag = 0; TMConfigure TMConf = new TMConfigure(); TMSourceCode TMCode = new TMSourceCode(); switch (tmConfFlag = TMConf.TMConfigureLoad("turing.xml")) { case 0: if (Supervisor.DEBUG) Console.WriteLine("Config file: OK"); break; case 5: if (Supervisor.DEBUG) Console.WriteLine("Config file: STATES_IS_INCORRECT"); break; case 6: if (Supervisor.DEBUG) Console.WriteLine("Config file: ALPH_IS_INCORRECT"); break; case 7: if (Supervisor.DEBUG) Console.WriteLine("Config file: TAPE_IS_INCORRECT"); break; case 8: if (Supervisor.DEBUG) Console.WriteLine("Config file: READING_HEAD_POS_IS_INCORRECT"); break; case 9: if (Supervisor.DEBUG) Console.WriteLine("Config file: INIT_STATE_IS_INCORRECT"); break; case 10: if (Supervisor.DEBUG) Console.WriteLine("Config file: ELEMENT_OF_TYPE_INCORRECT"); break; } if(tmConfFlag == 0) { TMCode.TMConfSet(TMConf); switch (tmCodeFlag = TMCode.TMCodeLoad("TMSourceCode.tm")) { case 0: if (Supervisor.DEBUG) Console.WriteLine("Source Code: OK"); break; case 1: if (Supervisor.DEBUG) Console.WriteLine("Source Code: SYNTAX_ERROR"); break; case 2: if (Supervisor.DEBUG) Console.WriteLine("Source Code: UNKNOWN_STATE_OF_MACHINE"); break; case 3: if (Supervisor.DEBUG) Console.WriteLine("Source Code: UNKNOWN_ELEMENT_OF_ALPHABET"); break; case 4: if (Supervisor.DEBUG) Console.WriteLine("Source Code: UNKNOWN_SYMBOL"); break; } } TMCore TM = new TMCore(); TM.TMConfSet(TMConf); TM.TMCodeSet(TMCode); TM.Start(); }
//-------------------------------------------------------------------------------- // TMSourceCode() // In: (TMConfigure) < config of Turing Machine // Out: - // Description: set configuration of Turing Machine public void TMConfSet(TMConfigure TMC) { TMConfig = TMC; }
public void TMConfSet(TMConfigure tc) { TMConf = tc; Tape = TMConf.Tape; }
public TMCore() { Tape = new ArrayList(); TMConf = new TMConfigure(); TMCode = new TMSourceCode(); }