Esempio n. 1
0
 public State(string arg, RegList reg, int l)
 {
     instrString = arg;
     registers   = reg;
     line        = l;
     instr       = new Instruction(instrString, reg);
 }
 public Instruction(string instr, RegList reg)
 {
     BuildAssemblyLookup();
     registers = new RegList(reg);
     registers.jumpLocation = new Tuple <int, string>(-1, "");
     instructionInfo        = parseInstrct(instr);
 }
Esempio n. 3
0
        public RegList NextState()
        {
            RegList ret = instr.Execute();

            if (ret == null)
            {
                eMessage = instr.eMessage;
            }
            return(ret);
        }
        public bool BuildNext()
        {
            RegList newState = CurrentState.NextState();

            if (newState == null)
            {
                eMessage = CurrentState.eMessage;
                return(false);
            }
            int nextInstr = CalculateJump(newState.jumpLocation);

            if (nextInstr >= ProgramStrings.Length)
            {
                eMessage = "Jump out of bounds";
                return(false);
            }
            State s = new State(ProgramStrings[nextInstr], newState, line);

            sList.Add(s);
            CurrentState = sList[++index];
            return(true);
        }
Esempio n. 5
0
 public RegList(RegList r) : base(r)
 {
     jumpLocation = new Tuple <int, string>(r.jumpLocation.Item1, r.jumpLocation.Item2);
 }