Esempio n. 1
0
 public String toString()
 {
     return("SWITCH(" + op.ToString() + ") " +
            " case " + opCase1.ToString() + ": " + case1.ToString()
            + " case " + opCase2.ToString() + ": " + case2.ToString()
            + " default: " + defaultCase.ToString());
 }
Esempio n. 2
0
 public override string ToString()
 {
     return("ExeStack:" + exeStack.ToString() + "\n" +
            "SymTable:" + symTable.ToString() + "\n" +
            "Out:" + outTbl.ToString() + "\n" +
            "FileTable:" + fileTable.ToString() + "\n" +
            "OriginalProgram:" + originalProgram.ToString() + "\n");
 }
        private void button1_Click(object sender, EventArgs e)
        {
            StmtMenu m = new StmtMenu();

            m.ShowDialog();
            prg = m.GetPrg();
            this.textBox1.Text = prg.ToString();
            ctr = new Controller <IStmt>(prg);
        }
Esempio n. 4
0
        public void UiInput()
        {
            StmtMenu();
            IStmt stmt = AddStmt(GetInputString());

            Console.WriteLine("You've added to program: ");
            Console.WriteLine(stmt.ToString());
            ctrl.Add(stmt);
        }
        protected void newTouched(object sender, EventArgs e)
        {
            IStmt prgStatement = new CompStmt(new AssignStmt("v", new ConstExp(0)), new CompStmt(new RepeatStmt(new CompStmt(new ForkStmt(new CompStmt(new PrintStmt(new VarExp("v")), new AssignStmt("v", new ArithExp(new VarExp("v"), "+", new ConstExp(1))))), new AssignStmt("v", new ArithExp(new VarExp("v"), "+", new ConstExp(1)))), new RelationalExp(new VarExp("v"), "==", new ConstExp(3))), new CompStmt(new SkipStmt(), new CompStmt(new SkipStmt(), new CompStmt(new SkipStmt(), new PrintStmt(new ArithExp(new VarExp("v"), "*", new ConstExp(10))))))));
            IStmt stmt         = prgStatement;
            //newStatement("First Statement:");
            //prgStatement;
            //
            List <PrgState> programs = new List <PrgState>();

            programs.Add(new PrgState(new MyLibraryStack <IStmt>(), new MyLibraryDictionary <string, int>(), new MyLibraryHeap <int>(), new MyLibraryList <int>(), stmt));
            ctrl.PrgList         = programs;
            textview.Buffer.Text = stmt.ToString();
        }
Esempio n. 6
0
        public ProgState onestep(ProgState prog)
        {
            MyIStack <IStmt> stk = prog.getStk();

            try { stk.isEmpty(); }
            catch (StackExceptions) { throw new StmtExecException("The program is over!!! \n"); }

            IStmt st = stk.pop();

            if (flag == 1)
            {
                System.Console.WriteLine(st.ToString());
            }

            try { return(st.execute(prog)); }
            catch (ControllerException e) { throw new StmtExecException(e); }
        }
Esempio n. 7
0
        public override String ToString()
        {
            string s = "Execution Stack: ";

            s += System.Environment.NewLine;
            s += exeStack.ToString();
            s += "Symbol Table: ";
            s += System.Environment.NewLine;
            s += symTable.ToString();
            s += "Messages: ";
            s += System.Environment.NewLine;
            s += messages.ToString();
            s += "File table: ";
            s += System.Environment.NewLine;
            s += fileTable.ToString();
            s += "Original program: ";
            s += System.Environment.NewLine;
            s += originalPrg.ToString();
            s += System.Environment.NewLine;
            s += "--------------------------------------------------------------------";
            return(s);
        }
Esempio n. 8
0
 public override String ToString()
 {
     return("if ( " + exp.ToString() + " ) then ( " + thenStmt.ToString() + ")");
 }
Esempio n. 9
0
 private void button2_Click(object sender, EventArgs e)
 {
     prg = new AssignStmt(GetString(), GetExp());
     this.textBox1.Text = prg.ToString();
     Close();
 }
Esempio n. 10
0
 private void button1_Click(object sender, EventArgs e)
 {
     prg = new CompStmt(ShowMenu(), ShowMenu());
     this.textBox1.Text = prg.ToString();
     Close();
 }
Esempio n. 11
0
 public void Init()
 {
     stmt = new CompStmt(new AssignStmt("a", new ArithExpr(new ConstExpr(2), "*",
                                                           new ConstExpr(3))), new PrintStmt(new ConstExpr(33)));
     Assert.AreEqual("( a = 2 * 3; print( 33 ) )", stmt.ToString());
 }
Esempio n. 12
0
 public override string ToString()
 {
     return("IF(" + mExp.ToString() + ")THEN(" + mThenS.ToString() + ")ELSE(" + mElseS.ToString() + ")");
 }
Esempio n. 13
0
 public override string ToString()
 {
     return("While( " + exp.ToString() + ") { " + stmt.ToString() + " }");
 }
Esempio n. 14
0
 public override string ToString()
 {
     return("IF(" + exp.ToString() + ")THEN(" + thenS.ToString() + ")");
 }
Esempio n. 15
0
 public override string ToString()
 {
     return(" forkStmt ( " + mStmt.ToString() + " ) ");
 }
Esempio n. 16
0
 public override String ToString()
 {
     return("WHILE " + exp.ToString() + " THEN(" + statement.ToString() + ") ");
 }
Esempio n. 17
0
 public override string ToString()
 {
     return("IF(" + condition.ToString() + ") THEN (" + thenS.ToString()
            + ") ELSE (" + elseS.ToString() + ")");
 }
Esempio n. 18
0
 public override string ToString()
 {
     return("repeat (" + stmt.ToString() + ") until " + exp.ToString() + "");
 }
 public override string ToString()
 {
     return("SWITCH (" + mVarExp.ToString() + ")  CASE (" + mExp1.ToString() + "): " + mStatement1.ToString() +
            "   CASE (" + mExp2.ToString() + "): " + mStatement2.ToString() + "  DEFAULT: " + mStatement3.ToString());
 }
Esempio n. 20
0
 public override String ToString()
 {
     return("( If " + expr.ToString() + " then " + ifs.ToString() + " else " + elses.ToString() + ")");
 }
Esempio n. 21
0
 public void Init()
 {
     stmt = new PrintStmt(new ArithExpr(new ConstExpr(3), "+", new ConstExpr(4)));
     Assert.AreEqual("print( 3 + 4 )", stmt.ToString());
 }
Esempio n. 22
0
 public void Init()
 {
     stmt = new IfStmt(new VarExpr("a"), new AssignStmt("v", new ConstExpr(2)), new
                       AssignStmt("v", new ConstExpr(3)));
     Assert.AreEqual("If a then v = 2 else v = 3", stmt.ToString());
 }
Esempio n. 23
0
 public override string ToString()
 {
     return("If " + expr.ToString() + " then " + stmt1.ToString() + " else " + stmt2.ToString());
 }
Esempio n. 24
0
 public override String ToString()
 {
     return("fork( " + stm.ToString() + ")");
 }
Esempio n. 25
0
 public override String ToString()
 {
     return("fork(" + forkStmt.ToString() + ")");
 }
Esempio n. 26
0
 public override String ToString()
 {
     return("IF (" + exp.ToString() + ") THEN (" + thenS.ToString() + ") ELSE (" + elseS.ToString() + ")");
 }
Esempio n. 27
0
 public override String ToString()
 {
     return("Switch (" + var.ToString() + ") case (" + exp1.ToString() + "): " + stm1.ToString() + "case (" + exp2.ToString() + "):" + stm2.ToString() + "default: " + stm3.ToString());
 }
Esempio n. 28
0
 public void Init()
 {
     stmt = new AssignStmt("a", new ArithExpr(new ConstExpr(2), "*", new ConstExpr(3)));
     Assert.AreEqual("a = 2 * 3", stmt.ToString());
 }
Esempio n. 29
0
 public override String ToString()
 {
     return("(" + first.ToString() + ";" + snd.ToString() + ")");
 }
Esempio n. 30
0
 public override string ToString()
 {
     return(first.ToString() + "; " + second.ToString());
 }