Esecuzione di Program unoMaS{ int R0 = 10; int R1 = 3; int R2 = 5; p0: R0 = 0; p1: if (R1 == 0) goto p4; R1 = R1 - 1; p2: R2 = R2 + 1; p3: if (R0 == 0) goto p1; R0 = R0 - 1; p4: goto End; End: ; } sintassi astratta # let aa = Prog ("unoMaS", Block (SeqD (Var (Int, "R0", N 10), SeqD (Var (Int, "R1", N 3), SeqD (Var (Int, "R2", N 5), ED))), SeqC (SeqC (SeqC (SeqC (SeqC (SeqC (SeqC (LabC ("p0", Upd (Val "R0", N 0)), LabC ("p1", IfT (Eq (Val "R1", N 0), Goto "p4"))), UnL (Upd (Val "R1", Minus (Val "R1", N 1)))), LabC ("p2", Upd (Val "R2", Plus (Val "R2", N 1)))), LabC ("p3", IfT (Eq (Val "R0", N 0), Goto "p1"))), UnL (Upd (Val "R0", Minus (Val "R0", N 1)))), LabC ("p4", Goto "End")), LabC ("End", ES)))) ;; esecuzione con traccia # progSem aa;; Stack: >{unoMaS,0,[R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-10,L1<-3,L2<-5] Stack: >{unoMaS,0,[p0/(lab,:cmd:); R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-0,L1<-3,L2<-5] Stack: >{unoMaS,0,[p1/(lab,:cmd:); p0/(lab,:cmd:); R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-0,L1<-3,L2<-5] Stack: >{unoMaS,0,[p1/(lab,:cmd:); p0/(lab,:cmd:); R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-0,L1<-2,L2<-5] Stack: >{unoMaS,0,[p2/(lab,:cmd:); p1/(lab,:cmd:); p0/(lab,:cmd:); R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-0,L1<-2,L2<-6] Stack: >{unoMaS,0,[p3/(lab,:cmd:); p2/(lab,:cmd:); p1/(lab,:cmd:); p0/(lab,:cmd:); R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-0,L1<-2,L2<-6] Stack: >{unoMaS,0,[p3/(lab,:cmd:); p2/(lab,:cmd:); p1/(lab,:cmd:); p0/(lab,:cmd:); R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-0,L1<-1,L2<-6] Stack: >{unoMaS,0,[p3/(lab,:cmd:); p2/(lab,:cmd:); p1/(lab,:cmd:); p0/(lab,:cmd:); R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-0,L1<-1,L2<-7] Stack: >{unoMaS,0,[p3/(lab,:cmd:); p2/(lab,:cmd:); p1/(lab,:cmd:); p0/(lab,:cmd:); R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-0,L1<-1,L2<-7] Stack: >{unoMaS,0,[p3/(lab,:cmd:); p2/(lab,:cmd:); p1/(lab,:cmd:); p0/(lab,:cmd:); R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-0,L1<-0,L2<-7] Stack: >{unoMaS,0,[p3/(lab,:cmd:); p2/(lab,:cmd:); p1/(lab,:cmd:); p0/(lab,:cmd:); R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-0,L1<-0,L2<-8] Stack: >{unoMaS,0,[End/(lab,:cmd:); p4/(lab,:cmd:); p3/(lab,:cmd:); p2/(lab,:cmd:); p1/(lab,:cmd:); p0/(lab,:cmd:); R2/(Mint,L2); R1/(Mint,L1); R0/(Mint,L0)],:cmdNext:,[N]} ] Store: [L0<-0,L1<-0,L2<-8] SUCCESSFUL_TERMINATION - : unit = () # Program unoMaS{ int R0 = 10; int R1 = 3; int R2 = 5; p0: R0 = 0; p1: if (R1 == 0) goto p4; R1 = R1 - 1; p2: R2 = R2 + 1; p3: if (R0 == 0) goto p1; R0 = R0 - 1; p4: goto End; End: ; }