Esempio n. 1
0
        private void Reset()
        {
            state = new InterpreterState();

            outputWindow.Text    = "OUTPUT:";
            labelHelp.Content    = "Help variable value: 0";
            labelIsDebug.Content = "Is in debug: false";
            labelIsBreak.Content = "On breakpoint: false";
        }
Esempio n. 2
0
        public Interpreter(TextBox outputWindow, Label labelHelp, Label labelIsBreak, Label labelIsDebug)
        {
            state = new InterpreterState();

            instructionsByCode = new Dictionary <char, IInstruction>();

            instructionsByCode.Add('+', new IncrementMemoryCell());
            instructionsByCode.Add('-', new DecrementMemoryCell());
            instructionsByCode.Add('>', new IncrementPointer());
            instructionsByCode.Add('<', new DecrementPointer());
            instructionsByCode.Add('$', new SaveToStorage());
            instructionsByCode.Add('!', new LoadToStorage());
            instructionsByCode.Add('@', new Breakpoint());
            instructionsByCode.Add('[', new WhileStart());
            instructionsByCode.Add(']', new WhileEnd());
            instructionsByCode.Add(',', new ReadInput());
            instructionsByCode.Add('.', new Print());

            this.labelHelp    = labelHelp;
            this.labelIsBreak = labelIsBreak;
            this.labelIsDebug = labelIsDebug;
            this.outputWindow = outputWindow;
        }