Beispiel #1
0
        /// <summary>
        /// 解释执行
        /// </summary>
        public void Run()
        {
            //清空输出框
            MainFram.outputRichTextBox.Text = "";
            //Win32.AllocConsole();//打开命令行
            for (int i = 0; i < TreeNode.Count; ++i)
            {
                Four_code FC = TreeNode[i].fc;
                LEVEL = TreeNode[i].level;
                switch (FC.op)
                {
                case "assign":
                    Assign(FC.arg1, FC.arg2);
                    break;

                case "read":
                    Read(FC.arg1);
                    break;

                case "write":
                    Write(FC.arg1);
                    break;

                case "sub":
                    Sub(FC.arg1, FC.arg2, FC.result);
                    break;

                case "add":
                    Add(FC.arg1, FC.arg2, FC.result);
                    break;

                case "mul":
                    Mul(FC.arg1, FC.arg2, FC.result);
                    break;

                case "div":
                    Div(FC.arg1, FC.arg2, FC.result);
                    break;

                case "<":
                    Less(FC.arg1, FC.arg2, FC.result);
                    break;

                case ">":
                    More(FC.arg1, FC.arg2, FC.result);
                    break;

                case "<=":
                    LessE(FC.arg1, FC.arg2, FC.result);
                    break;

                case ">=":
                    MoreE(FC.arg1, FC.arg2, FC.result);
                    break;

                case "==":
                    Equal(FC.arg1, FC.arg2, FC.result);
                    break;

                case "!=":
                    Nequal(FC.arg1, FC.arg2, FC.result);
                    break;

                case "jumpto":
                    i = Jumpto(FC.result, i, FC.arg1);
                    break;

                case "jumpat":
                case "mark1":
                case "mark3":
                    break;

                case "mark0":
                    i = JumpToMark(i);
                    break;

                case "mark2":
                    i = JumpToMark1(i, FC.arg1);
                    break;

                default:
                    break;
                }
            }
            //Console.WriteLine("请按回车键继续...");
            //Console.ReadLine();
            //Win32.FreeConsole();
        }
Beispiel #2
0
 public TempCode(Four_code _fc, int _lev)
 {
     fc    = _fc;
     level = _lev;
 }