Beispiel #1
0
 public String toString()
 {
     return("SWITCH(" + op.ToString() + ") " +
            " case " + opCase1.ToString() + ": " + case1.ToString()
            + " case " + opCase2.ToString() + ": " + case2.ToString()
            + " default: " + defaultCase.ToString());
 }
Beispiel #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);
        }
Beispiel #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();
        }
Beispiel #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); }
        }
Beispiel #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);
        }
Beispiel #8
0
 public override String ToString()
 {
     return("if ( " + exp.ToString() + " ) then ( " + thenStmt.ToString() + ")");
 }
Beispiel #9
0
 private void button2_Click(object sender, EventArgs e)
 {
     prg = new AssignStmt(GetString(), GetExp());
     this.textBox1.Text = prg.ToString();
     Close();
 }
Beispiel #10
0
 private void button1_Click(object sender, EventArgs e)
 {
     prg = new CompStmt(ShowMenu(), ShowMenu());
     this.textBox1.Text = prg.ToString();
     Close();
 }
Beispiel #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());
 }
Beispiel #12
0
 public override string ToString()
 {
     return("IF(" + mExp.ToString() + ")THEN(" + mThenS.ToString() + ")ELSE(" + mElseS.ToString() + ")");
 }
 public override string ToString()
 {
     return("While( " + exp.ToString() + ") { " + stmt.ToString() + " }");
 }
 public override string ToString()
 {
     return("IF(" + exp.ToString() + ")THEN(" + thenS.ToString() + ")");
 }
Beispiel #15
0
 public override string ToString()
 {
     return(" forkStmt ( " + mStmt.ToString() + " ) ");
 }
Beispiel #16
0
 public override String ToString()
 {
     return("WHILE " + exp.ToString() + " THEN(" + statement.ToString() + ") ");
 }
Beispiel #17
0
 public override string ToString()
 {
     return("IF(" + condition.ToString() + ") THEN (" + thenS.ToString()
            + ") ELSE (" + elseS.ToString() + ")");
 }
 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());
 }
Beispiel #20
0
 public override String ToString()
 {
     return("( If " + expr.ToString() + " then " + ifs.ToString() + " else " + elses.ToString() + ")");
 }
Beispiel #21
0
 public void Init()
 {
     stmt = new PrintStmt(new ArithExpr(new ConstExpr(3), "+", new ConstExpr(4)));
     Assert.AreEqual("print( 3 + 4 )", stmt.ToString());
 }
Beispiel #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());
 }
Beispiel #23
0
 public override string ToString()
 {
     return("If " + expr.ToString() + " then " + stmt1.ToString() + " else " + stmt2.ToString());
 }
Beispiel #24
0
 public override String ToString()
 {
     return("fork( " + stm.ToString() + ")");
 }
Beispiel #25
0
 public override String ToString()
 {
     return("fork(" + forkStmt.ToString() + ")");
 }
Beispiel #26
0
 public override String ToString()
 {
     return("IF (" + exp.ToString() + ") THEN (" + thenS.ToString() + ") ELSE (" + elseS.ToString() + ")");
 }
Beispiel #27
0
 public override String ToString()
 {
     return("Switch (" + var.ToString() + ") case (" + exp1.ToString() + "): " + stm1.ToString() + "case (" + exp2.ToString() + "):" + stm2.ToString() + "default: " + stm3.ToString());
 }
Beispiel #28
0
 public void Init()
 {
     stmt = new AssignStmt("a", new ArithExpr(new ConstExpr(2), "*", new ConstExpr(3)));
     Assert.AreEqual("a = 2 * 3", stmt.ToString());
 }
Beispiel #29
0
 public override String ToString()
 {
     return("(" + first.ToString() + ";" + snd.ToString() + ")");
 }
Beispiel #30
0
 public override string ToString()
 {
     return(first.ToString() + "; " + second.ToString());
 }