Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
 public void TMCodeSet(TMSourceCode ts)
 {
     TMCode = ts;
 }
Exemplo n.º 3
0
 public TMCore()
 {
     Tape = new ArrayList();
     TMConf = new TMConfigure();
     TMCode = new TMSourceCode();
 }