Exemple #1
0
        public static int Main(params string[] args)
        {
            string fl = "test.tm";

            if (args.Length > 0x00)
            {
                fl = args [0x00];
            }
            using (FileStream fs = File.OpenRead(fl)) {
                using (TextReader tr = new StreamReader(fs)) {
                    TM     tm  = TM.Parse(tr);
                    string inp = "";
                    if (args.Length > 0x01)
                    {
                        inp = args [0x01];
                    }
                    TMSimulation tmsim = new TMSimulation(tm, inp);
                    Console.WriteLine(tmsim);
                    while (Console.In.Read() != 0x00)
                    {
                        tmsim.Step();
                        Console.WriteLine(tmsim);
                    }
                }
            }
            return(0x00);
        }
 public TMSimulation(TM machine, IEnumerable<Character> chars)
 {
     this.CurrentState = machine.BeginState;
     foreach (Character c in chars.Reverse()) {
         RStack.Push (c);
     }
     this.Fix ();
 }
Exemple #3
0
 public TMSimulation(TM machine, IEnumerable <Character> chars)
 {
     this.CurrentState = machine.BeginState;
     foreach (Character c in chars.Reverse())
     {
         RStack.Push(c);
     }
     this.Fix();
 }
 public TMSimulation(TM machine, IEnumerable<char> chars)
     : this(machine, chars.Select (Character.Parse))
 {
 }
Exemple #5
0
 public TMSimulation(TM machine, IEnumerable <char> chars) : this(machine, chars.Select(Character.Parse))
 {
 }