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 (); }
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(); }
private void inputProgram() { // IStmt prgStatement = new CompStmt(new NewStmt("a", new ConstExp(10)), new CompStmt(new WriteHeapStmt("a", new ConstExp(4)), new CompStmt(new AssignStmt("b", new ConstExp(1)), new PrintStmt(new ReadHeapExp("b"))))); //new CompStmt (new AssignStmt ("a", new ArithExp (new ConstExp (2), "-", new ConstExp (3))), new CompStmt (new IfThenStmt (new VarExp ("a"), new AssignStmt ("v", new ConstExp (2))), new PrintStmt (new VarExp ("v")))); //inputStatement (); IStmt st1 = new AssignStmt("v", new ConstExp(10)); IStmt st2 = new NewStmt("a", new ConstExp(22)); IStmt st3 = new AssignStmt("v", new ConstExp(32)); IStmt st4 = new PrintStmt(new VarExp("v")); IStmt st5 = new PrintStmt(new ReadHeapExp("a")); IStmt st8 = new ForkStmt(new CompStmt(new WriteHeapStmt("a", new ConstExp(30)), new CompStmt(st3, new CompStmt(st4, st5)))); IStmt st6 = new PrintStmt(new VarExp("v")); IStmt st7 = new PrintStmt(new ReadHeapExp("a")); IStmt prgStatement = new CompStmt(st1, new CompStmt(st2, new CompStmt(st8, new CompStmt(st6, new CompStmt(st7, new CompStmt(new SkipStmt(), new CompStmt(new SkipStmt(), new SkipStmt()))))))); List <PrgState> programs = new List <PrgState> (); programs.Add(new PrgState(new MyLibraryStack <IStmt> (), new MyLibraryDictionary <String, int> (), new MyLibraryHeap <int> (), new MyLibraryList <int> (), prgStatement)); programs.ForEach(p => print(p.ToString())); ctrl = new Controller(new MyRepository(programs)); ctrl.serializeProgramState(); }
private void inputProgram() { // IStmt prgStatement = new CompStmt(new NewStmt("a", new ConstExp(10)), new CompStmt(new WriteHeapStmt("a", new ConstExp(4)), new CompStmt(new AssignStmt("b", new ConstExp(1)), new PrintStmt(new ReadHeapExp("b"))))); //new CompStmt (new AssignStmt ("a", new ArithExp (new ConstExp (2), "-", new ConstExp (3))), new CompStmt (new IfThenStmt (new VarExp ("a"), new AssignStmt ("v", new ConstExp (2))), new PrintStmt (new VarExp ("v")))); //inputStatement (); IStmt st1 = new AssignStmt("v", new ConstExp(10)); IStmt st2 = new NewStmt("a", new ConstExp(22)); IStmt st3 = new AssignStmt("v", new ConstExp(32)); IStmt st4 = new PrintStmt(new VarExp("v")); IStmt st5 = new PrintStmt(new ReadHeapExp("a")); IStmt st8 = new ForkStmt(new CompStmt(new WriteHeapStmt("a", new ConstExp(30)), new CompStmt(st3, new CompStmt(st4, st5)))); IStmt st6 = new PrintStmt(new VarExp("v")); IStmt st7 = new PrintStmt(new ReadHeapExp("a")); IStmt prgStatement = new CompStmt(st1, new CompStmt(st2, new CompStmt(st8, new CompStmt(st6,new CompStmt (st7, new CompStmt(new SkipStmt(), new CompStmt(new SkipStmt(), new SkipStmt() ))))))); List<PrgState> programs = new List<PrgState> (); programs.Add (new PrgState (new MyLibraryStack<IStmt> (), new MyLibraryDictionary<String, int> (), new MyLibraryHeap<int> (), new MyLibraryList<int> (), prgStatement)); programs.ForEach(p => print(p.ToString())); ctrl = new Controller (new MyRepository (programs)); ctrl.serializeProgramState (); }