From 675c1056bfe935a2da9be85c3791214e30f2ba24 Mon Sep 17 00:00:00 2001 From: "Jeremy G. Siek" Date: Mon, 1 Mar 2021 17:21:21 -0500 Subject: [PATCH] update goldens to match fixes in PR #308 (#321) --- executable_semantics/testdata/choice1.golden | 861 +++++++++++++++++- executable_semantics/testdata/fun1.golden | 158 +++- executable_semantics/testdata/fun2.golden | 296 +++++- .../testdata/fun_recur.golden | 505 +++++++++- executable_semantics/testdata/funptr1.golden | 266 +++++- 5 files changed, 2056 insertions(+), 30 deletions(-) diff --git a/executable_semantics/testdata/choice1.golden b/executable_semantics/testdata/choice1.golden index a6ff8240cf08..45d5532882c4 100644 --- a/executable_semantics/testdata/choice1.golden +++ b/executable_semantics/testdata/choice1.golden @@ -1,7 +1,7 @@ ********** source program ********** choice Ints { alt None (); -alt One Int; +alt One (0 = Int); alt Two (0 = Int, 1 = Int); } fn main () -> Int { @@ -29,12 +29,14 @@ return n; } choice MoreInts { alt None (); -alt One Int; +alt One (0 = Int); alt Two (0 = Int, 1 = Int); } ********** type checking ********** --- step exp () ---> +--- step exp (0 = Int) ---> --- step exp Int ---> +--- handle value Int with (0 = Int)<1>(Int,) ---> --- step exp (0 = Int, 1 = Int) ---> --- step exp Int ---> --- handle value Int with (0 = Int, 1 = Int)<1>(Int,) ---> @@ -42,7 +44,9 @@ alt Two (0 = Int, 1 = Int); --- handle value Int with (0 = Int, 1 = Int)<2>(Int,Int,) ---> --- step exp Int ---> --- step exp () ---> +--- step exp (0 = Int) ---> --- step exp Int ---> +--- handle value Int with (0 = Int)<1>(Int,) ---> --- step exp (0 = Int, 1 = Int) ---> --- step exp Int ---> --- handle value Int with (0 = Int, 1 = Int)<1>(Int,) ---> @@ -50,7 +54,852 @@ alt Two (0 = Int, 1 = Int); --- handle value Int with (0 = Int, 1 = Int)<2>(Int,Int,) ---> --- step exp Int ---> --- step exp auto ---> -13: type error in call -expected: Int -actual: Tuple(0 = Int) -EXIT CODE: 255 +--- step exp auto ---> +--- step exp auto ---> +18: compilation error, pattern variables are only allowed in pattern context +--- step exp auto ---> +20: compilation error, pattern variables are only allowed in pattern context +--- step exp auto ---> +20: compilation error, pattern variables are only allowed in pattern context +--- step exp auto ---> +24: compilation error, pattern variables are only allowed in pattern context +--- step exp auto ---> +28: compilation error, pattern variables are only allowed in pattern context +--- step exp auto ---> +28: compilation error, pattern variables are only allowed in pattern context +--- step exp auto ---> + +********** type checking complete ********** +choice Ints { +alt None (); +alt One (0 = Int); +alt Two (0 = Int, 1 = Int); +} +fn main () -> Int { +var auto: x = Ints.None(); +var auto: y = Ints.One(0 = 42); +var auto: n = 0; +match (y) { +case Ints.None => +n = (n + 2); +case Ints.One(0 = auto: x) => +n = ((x + 1) - 42); +case Ints.Two(0 = auto: a, 1 = auto: b) => +n = 2; +} +match (x) { +case Ints.One(0 = auto: x) => +n = (x + 2); +case Ints.None() => +n = (n - 1); +case Ints.Two(0 = auto: x, 1 = auto: y) => +n = 5; +} +return n; +} +choice MoreInts { +alt None (); +alt One (0 = Int); +alt Two (0 = Int, 1 = Int); +} +********** starting execution ********** +********** initializing globals ********** +--- step exp () ---> +--- step exp (0 = Int) ---> +--- step exp Int ---> +--- handle value Int with (0 = Int)<1>(Int,) ---> +--- step exp (0 = Int, 1 = Int) ---> +--- step exp Int ---> +--- handle value Int with (0 = Int, 1 = Int)<1>(Int,) ---> +--- step exp Int ---> +--- handle value Int with (0 = Int, 1 = Int)<2>(Int,Int,) ---> +--- step exp () ---> +--- step exp () ---> +--- step exp (0 = Int) ---> +--- step exp Int ---> +--- handle value Int with (0 = Int)<1>(Int,) ---> +--- step exp (0 = Int, 1 = Int) ---> +--- step exp Int ---> +--- handle value Int with (0 = Int, 1 = Int)<1>(Int,) ---> +--- step exp Int ---> +--- handle value Int with (0 = Int, 1 = Int)<2>(Int,Int,) ---> +********** calling main function ********** +{ +stack: top{main()<-1>} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp main() ---> +{ +stack: top{main<-1> :: main()<0>} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp main ---> +{ +stack: top{fun
<-1> :: main()<0>} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value fun
with main()<1>(fun
,) ---> +{ +stack: top{()<-1> :: main()<1>(fun
,)} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp () ---> +{ +stack: top{()<-1> :: main()<1>(fun
,)} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value () with main()<2>(fun
,(),) ---> +pattern_match((), ()) +{ +stack: main{var auto: x = Ints.None(); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt var auto: x = Ints.None(); ... ---> +{ +stack: main{var auto: x = Ints.None();<-1> :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt var auto: x = Ints.None(); ---> +{ +stack: main{Ints.None()<-1> :: var auto: x = Ints.None();<0> :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp Ints.None() ---> +{ +stack: main{Ints.None<-1> :: Ints.None()<0> :: var auto: x = Ints.None();<0> :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp Ints.None ---> +{ +stack: main{Ints<-1> :: Ints.None<0> :: Ints.None()<0> :: var auto: x = Ints.None();<0> :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step lvalue Ints ---> +{ +stack: main{ptr<3><-1> :: Ints.None<0> :: Ints.None()<0> :: var auto: x = Ints.None();<0> :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value ptr<3> with Ints.None<1>(ptr<3>,) ---> +{ +stack: main{Ints.None<-1> :: Ints.None()<0> :: var auto: x = Ints.None();<0> :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value Ints.None with Ints.None()<1>(Ints.None,) ---> +{ +stack: main{()<-1> :: Ints.None()<1>(Ints.None,) :: var auto: x = Ints.None();<0> :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp () ---> +{ +stack: main{()<-1> :: Ints.None()<1>(Ints.None,) :: var auto: x = Ints.None();<0> :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value () with Ints.None()<2>(Ints.None,(),) ---> +{ +stack: main{alt Ints.None ()<-1> :: var auto: x = Ints.None();<0> :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value alt Ints.None () with var auto: x = Ints.None();<1>(alt Ints.None (),) ---> +{ +stack: main{auto: x<-1> :: var auto: x = Ints.None();<1>(alt Ints.None (),) :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp auto: x ---> +{ +stack: main{auto<-1> :: auto: x<0> :: var auto: x = Ints.None();<1>(alt Ints.None (),) :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp auto ---> +{ +stack: main{auto<-1> :: auto: x<0> :: var auto: x = Ints.None();<1>(alt Ints.None (),) :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value auto with auto: x<1>(auto,) ---> +{ +stack: main{auto: x<-1> :: var auto: x = Ints.None();<1>(alt Ints.None (),) :: var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value auto: x with var auto: x = Ints.None();<2>(alt Ints.None (),auto: x,) ---> +pattern_match(auto: x, alt Ints.None ()) +{ +stack: main{var auto: y = Ints.One(0 = 42); ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt var auto: y = Ints.One(0 = 42); ... ---> +{ +stack: main{var auto: y = Ints.One(0 = 42);<-1> :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt var auto: y = Ints.One(0 = 42); ---> +{ +stack: main{Ints.One(0 = 42)<-1> :: var auto: y = Ints.One(0 = 42);<0> :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp Ints.One(0 = 42) ---> +{ +stack: main{Ints.One<-1> :: Ints.One(0 = 42)<0> :: var auto: y = Ints.One(0 = 42);<0> :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp Ints.One ---> +{ +stack: main{Ints<-1> :: Ints.One<0> :: Ints.One(0 = 42)<0> :: var auto: y = Ints.One(0 = 42);<0> :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step lvalue Ints ---> +{ +stack: main{ptr<3><-1> :: Ints.One<0> :: Ints.One(0 = 42)<0> :: var auto: y = Ints.One(0 = 42);<0> :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value ptr<3> with Ints.One<1>(ptr<3>,) ---> +{ +stack: main{Ints.One<-1> :: Ints.One(0 = 42)<0> :: var auto: y = Ints.One(0 = 42);<0> :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value Ints.One with Ints.One(0 = 42)<1>(Ints.One,) ---> +{ +stack: main{(0 = 42)<-1> :: Ints.One(0 = 42)<1>(Ints.One,) :: var auto: y = Ints.One(0 = 42);<0> :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp (0 = 42) ---> +{ +stack: main{42<-1> :: (0 = 42)<0> :: Ints.One(0 = 42)<1>(Ints.One,) :: var auto: y = Ints.One(0 = 42);<0> :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp 42 ---> +{ +stack: main{42<-1> :: (0 = 42)<0> :: Ints.One(0 = 42)<1>(Ints.One,) :: var auto: y = Ints.One(0 = 42);<0> :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value 42 with (0 = 42)<1>(42,) ---> +{ +stack: main{(0 = 42@12)<-1> :: Ints.One(0 = 42)<1>(Ints.One,) :: var auto: y = Ints.One(0 = 42);<0> :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value (0 = 42@12) with Ints.One(0 = 42)<2>(Ints.One,(0 = 42@12),) ---> +{ +stack: main{alt Ints.One (0 = 42@13)<-1> :: var auto: y = Ints.One(0 = 42);<0> :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value alt Ints.One (0 = 42@13) with var auto: y = Ints.One(0 = 42);<1>(alt Ints.One (0 = 42@13),) ---> +{ +stack: main{auto: y<-1> :: var auto: y = Ints.One(0 = 42);<1>(alt Ints.One (0 = 42@13),) :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp auto: y ---> +{ +stack: main{auto<-1> :: auto: y<0> :: var auto: y = Ints.One(0 = 42);<1>(alt Ints.One (0 = 42@13),) :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp auto ---> +{ +stack: main{auto<-1> :: auto: y<0> :: var auto: y = Ints.One(0 = 42);<1>(alt Ints.One (0 = 42@13),) :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value auto with auto: y<1>(auto,) ---> +{ +stack: main{auto: y<-1> :: var auto: y = Ints.One(0 = 42);<1>(alt Ints.One (0 = 42@13),) :: var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, +env: x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value auto: y with var auto: y = Ints.One(0 = 42);<2>(alt Ints.One (0 = 42@13),auto: y,) ---> +pattern_match(auto: y, alt Ints.One (0 = 42@13)) +{ +stack: main{var auto: n = 0; ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), +env: y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt var auto: n = 0; ... ---> +{ +stack: main{var auto: n = 0;<-1> :: match (y) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), +env: y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt var auto: n = 0; ---> +{ +stack: main{0<-1> :: var auto: n = 0;<0> :: match (y) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), +env: y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp 0 ---> +{ +stack: main{0<-1> :: var auto: n = 0;<0> :: match (y) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), +env: y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value 0 with var auto: n = 0;<1>(0,) ---> +{ +stack: main{auto: n<-1> :: var auto: n = 0;<1>(0,) :: match (y) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), +env: y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp auto: n ---> +{ +stack: main{auto<-1> :: auto: n<0> :: var auto: n = 0;<1>(0,) :: match (y) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), +env: y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp auto ---> +{ +stack: main{auto<-1> :: auto: n<0> :: var auto: n = 0;<1>(0,) :: match (y) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), +env: y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value auto with auto: n<1>(auto,) ---> +{ +stack: main{auto: n<-1> :: var auto: n = 0;<1>(0,) :: match (y) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), +env: y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value auto: n with var auto: n = 0;<2>(0,auto: n,) ---> +pattern_match(auto: n, 0) +{ +stack: main{match (y) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt match (y) {...} ... ---> +{ +stack: main{match (y) {...}<-1> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt match (y) {...} ---> +{ +stack: main{y<-1> :: match (y) {...}<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp y ---> +{ +stack: main{alt Ints.One (0 = 42@14)<-1> :: match (y) {...}<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value alt Ints.One (0 = 42@14) with match (y) {...}<1>(alt Ints.One (0 = 42@14),) ---> +{ +stack: main{Ints.None<-1> :: match (y) {...}<1>(alt Ints.One (0 = 42@14),) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp Ints.None ---> +{ +stack: main{Ints<-1> :: Ints.None<0> :: match (y) {...}<1>(alt Ints.One (0 = 42@14),) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step lvalue Ints ---> +{ +stack: main{ptr<3><-1> :: Ints.None<0> :: match (y) {...}<1>(alt Ints.One (0 = 42@14),) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value ptr<3> with Ints.None<1>(ptr<3>,) ---> +{ +stack: main{Ints.None<-1> :: match (y) {...}<1>(alt Ints.One (0 = 42@14),) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value Ints.None with match (y) {...}<2>(alt Ints.One (0 = 42@14),Ints.None,) ---> +pattern_match(Ints.None, alt Ints.One (0 = 42@14)) +{ +stack: main{Ints.One(0 = auto: x)<-1> :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp Ints.One(0 = auto: x) ---> +{ +stack: main{Ints.One<-1> :: Ints.One(0 = auto: x)<0> :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp Ints.One ---> +{ +stack: main{Ints<-1> :: Ints.One<0> :: Ints.One(0 = auto: x)<0> :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step lvalue Ints ---> +{ +stack: main{ptr<3><-1> :: Ints.One<0> :: Ints.One(0 = auto: x)<0> :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value ptr<3> with Ints.One<1>(ptr<3>,) ---> +{ +stack: main{Ints.One<-1> :: Ints.One(0 = auto: x)<0> :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value Ints.One with Ints.One(0 = auto: x)<1>(Ints.One,) ---> +{ +stack: main{(0 = auto: x)<-1> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp (0 = auto: x) ---> +{ +stack: main{auto: x<-1> :: (0 = auto: x)<0> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp auto: x ---> +{ +stack: main{auto<-1> :: auto: x<0> :: (0 = auto: x)<0> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp auto ---> +{ +stack: main{auto<-1> :: auto: x<0> :: (0 = auto: x)<0> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value auto with auto: x<1>(auto,) ---> +{ +stack: main{auto: x<-1> :: (0 = auto: x)<0> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value auto: x with (0 = auto: x)<1>(auto: x,) ---> +{ +stack: main{(0 = auto: x@19)<-1> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value (0 = auto: x@19) with Ints.One(0 = auto: x)<2>(Ints.One,(0 = auto: x@19),) ---> +{ +stack: main{alt Ints.One (0 = auto: x@20)<-1> :: match (y) {...}<3>(alt Ints.One (0 = 42@14),Ints.None,) :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value alt Ints.One (0 = auto: x@20) with match (y) {...}<4>(alt Ints.One (0 = 42@14),Ints.None,alt Ints.One (0 = auto: x@20),) ---> +pattern_match(alt Ints.One (0 = auto: x@20), alt Ints.One (0 = 42@14)) +pattern_match((0 = auto: x@20), (0 = 42@14)) +pattern_match(auto: x, 42) +{ +stack: main{n = ((x + 1) - 42);<-1> :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt n = ((x + 1) - 42); ---> +{ +stack: main{n<-1> :: n = ((x + 1) - 42);<0> :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step lvalue n ---> +{ +stack: main{ptr<16><-1> :: n = ((x + 1) - 42);<0> :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value ptr<16> with n = ((x + 1) - 42);<1>(ptr<16>,) ---> +{ +stack: main{((x + 1) - 42)<-1> :: n = ((x + 1) - 42);<1>(ptr<16>,) :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp ((x + 1) - 42) ---> +{ +stack: main{(x + 1)<-1> :: ((x + 1) - 42)<0> :: n = ((x + 1) - 42);<1>(ptr<16>,) :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp (x + 1) ---> +{ +stack: main{x<-1> :: (x + 1)<0> :: ((x + 1) - 42)<0> :: n = ((x + 1) - 42);<1>(ptr<16>,) :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp x ---> +{ +stack: main{42<-1> :: (x + 1)<0> :: ((x + 1) - 42)<0> :: n = ((x + 1) - 42);<1>(ptr<16>,) :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value 42 with (x + 1)<1>(42,) ---> +{ +stack: main{1<-1> :: (x + 1)<1>(42,) :: ((x + 1) - 42)<0> :: n = ((x + 1) - 42);<1>(ptr<16>,) :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp 1 ---> +{ +stack: main{1<-1> :: (x + 1)<1>(42,) :: ((x + 1) - 42)<0> :: n = ((x + 1) - 42);<1>(ptr<16>,) :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value 1 with (x + 1)<2>(42,1,) ---> +{ +stack: main{43<-1> :: ((x + 1) - 42)<0> :: n = ((x + 1) - 42);<1>(ptr<16>,) :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value 43 with ((x + 1) - 42)<1>(43,) ---> +{ +stack: main{42<-1> :: ((x + 1) - 42)<1>(43,) :: n = ((x + 1) - 42);<1>(ptr<16>,) :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp 42 ---> +{ +stack: main{42<-1> :: ((x + 1) - 42)<1>(43,) :: n = ((x + 1) - 42);<1>(ptr<16>,) :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value 42 with ((x + 1) - 42)<2>(43,42,) ---> +{ +stack: main{1<-1> :: n = ((x + 1) - 42);<1>(ptr<16>,) :: { + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value 1 with n = ((x + 1) - 42);<2>(ptr<16>,1,) ---> +{ +stack: main{{ + ... +} +<0> :: match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, 42, +env: x: 42, n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt { + ... +} + ---> +{ +stack: main{match (x) {...} ... <-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt match (x) {...} ... ---> +{ +stack: main{match (x) {...}<-1> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt match (x) {...} ---> +{ +stack: main{x<-1> :: match (x) {...}<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp x ---> +{ +stack: main{alt Ints.None ()<-1> :: match (x) {...}<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value alt Ints.None () with match (x) {...}<1>(alt Ints.None (),) ---> +{ +stack: main{Ints.One(0 = auto: x)<-1> :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp Ints.One(0 = auto: x) ---> +{ +stack: main{Ints.One<-1> :: Ints.One(0 = auto: x)<0> :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp Ints.One ---> +{ +stack: main{Ints<-1> :: Ints.One<0> :: Ints.One(0 = auto: x)<0> :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step lvalue Ints ---> +{ +stack: main{ptr<3><-1> :: Ints.One<0> :: Ints.One(0 = auto: x)<0> :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value ptr<3> with Ints.One<1>(ptr<3>,) ---> +{ +stack: main{Ints.One<-1> :: Ints.One(0 = auto: x)<0> :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value Ints.One with Ints.One(0 = auto: x)<1>(Ints.One,) ---> +{ +stack: main{(0 = auto: x)<-1> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp (0 = auto: x) ---> +{ +stack: main{auto: x<-1> :: (0 = auto: x)<0> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp auto: x ---> +{ +stack: main{auto<-1> :: auto: x<0> :: (0 = auto: x)<0> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp auto ---> +{ +stack: main{auto<-1> :: auto: x<0> :: (0 = auto: x)<0> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value auto with auto: x<1>(auto,) ---> +{ +stack: main{auto: x<-1> :: (0 = auto: x)<0> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value auto: x with (0 = auto: x)<1>(auto: x,) ---> +{ +stack: main{(0 = auto: x@23)<-1> :: Ints.One(0 = auto: x)<1>(Ints.One,) :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value (0 = auto: x@23) with Ints.One(0 = auto: x)<2>(Ints.One,(0 = auto: x@23),) ---> +{ +stack: main{alt Ints.One (0 = auto: x@24)<-1> :: match (x) {...}<1>(alt Ints.None (),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value alt Ints.One (0 = auto: x@24) with match (x) {...}<2>(alt Ints.None (),alt Ints.One (0 = auto: x@24),) ---> +pattern_match(alt Ints.One (0 = auto: x@24), alt Ints.None ()) +{ +stack: main{Ints.None()<-1> :: match (x) {...}<3>(alt Ints.None (),alt Ints.One (0 = auto: x@24),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp Ints.None() ---> +{ +stack: main{Ints.None<-1> :: Ints.None()<0> :: match (x) {...}<3>(alt Ints.None (),alt Ints.One (0 = auto: x@24),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp Ints.None ---> +{ +stack: main{Ints<-1> :: Ints.None<0> :: Ints.None()<0> :: match (x) {...}<3>(alt Ints.None (),alt Ints.One (0 = auto: x@24),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step lvalue Ints ---> +{ +stack: main{ptr<3><-1> :: Ints.None<0> :: Ints.None()<0> :: match (x) {...}<3>(alt Ints.None (),alt Ints.One (0 = auto: x@24),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value ptr<3> with Ints.None<1>(ptr<3>,) ---> +{ +stack: main{Ints.None<-1> :: Ints.None()<0> :: match (x) {...}<3>(alt Ints.None (),alt Ints.One (0 = auto: x@24),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value Ints.None with Ints.None()<1>(Ints.None,) ---> +{ +stack: main{()<-1> :: Ints.None()<1>(Ints.None,) :: match (x) {...}<3>(alt Ints.None (),alt Ints.One (0 = auto: x@24),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp () ---> +{ +stack: main{()<-1> :: Ints.None()<1>(Ints.None,) :: match (x) {...}<3>(alt Ints.None (),alt Ints.One (0 = auto: x@24),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value () with Ints.None()<2>(Ints.None,(),) ---> +{ +stack: main{alt Ints.None ()<-1> :: match (x) {...}<3>(alt Ints.None (),alt Ints.One (0 = auto: x@24),) :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value alt Ints.None () with match (x) {...}<4>(alt Ints.None (),alt Ints.One (0 = auto: x@24),alt Ints.None (),) ---> +pattern_match(alt Ints.None (), alt Ints.None ()) +pattern_match((), ()) +{ +stack: main{n = (n - 1);<-1> :: { + ... +} +<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt n = (n - 1); ---> +{ +stack: main{n<-1> :: n = (n - 1);<0> :: { + ... +} +<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step lvalue n ---> +{ +stack: main{ptr<16><-1> :: n = (n - 1);<0> :: { + ... +} +<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value ptr<16> with n = (n - 1);<1>(ptr<16>,) ---> +{ +stack: main{(n - 1)<-1> :: n = (n - 1);<1>(ptr<16>,) :: { + ... +} +<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp (n - 1) ---> +{ +stack: main{n<-1> :: (n - 1)<0> :: n = (n - 1);<1>(ptr<16>,) :: { + ... +} +<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp n ---> +{ +stack: main{1<-1> :: (n - 1)<0> :: n = (n - 1);<1>(ptr<16>,) :: { + ... +} +<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value 1 with (n - 1)<1>(1,) ---> +{ +stack: main{1<-1> :: (n - 1)<1>(1,) :: n = (n - 1);<1>(ptr<16>,) :: { + ... +} +<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp 1 ---> +{ +stack: main{1<-1> :: (n - 1)<1>(1,) :: n = (n - 1);<1>(ptr<16>,) :: { + ... +} +<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value 1 with (n - 1)<2>(1,1,) ---> +{ +stack: main{0<-1> :: n = (n - 1);<1>(ptr<16>,) :: { + ... +} +<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 1, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 1, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value 0 with n = (n - 1);<2>(ptr<16>,0,) ---> +{ +stack: main{{ + ... +} +<0> :: return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt { + ... +} + ---> +{ +stack: main{return n;<-1>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step stmt return n; ---> +{ +stack: main{n<-1> :: return n;<0>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- step exp n ---> +{ +stack: main{0<-1> :: return n;<0>} :: top{} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, alt Ints.None (), Ints.One, 42, 42, 42, alt Ints.One (0 = 42@14), 0, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: n: 0, y: alt Ints.One (0 = 42@14), x: alt Ints.None (), MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +--- handle value 0 with return n;<1>(0,) ---> +{ +stack: top{0<-1>} +heap: Int, Int, Int, choice Ints, fun
, Int, Int, Int, choice MoreInts, Ints.None, !!alt Ints.None !!(), Ints.One, 42, 42, !!42, !!alt Ints.One !!(0 = !!42@14), !!0, Ints.None, Ints.One, auto: x, auto: x, !!42, Ints.One, auto: x, auto: x, Ints.None, +env: MoreInts: choice MoreInts, main: fun
, Ints: choice Ints, +} +result: 0 diff --git a/executable_semantics/testdata/fun1.golden b/executable_semantics/testdata/fun1.golden index f1f18d2ba160..77b895e21ce0 100644 --- a/executable_semantics/testdata/fun1.golden +++ b/executable_semantics/testdata/fun1.golden @@ -1,5 +1,5 @@ ********** source program ********** -fn f Int: x -> Int { +fn f (0 = Int: x) -> Int { return (x - 1); } @@ -14,7 +14,155 @@ return f(0 = 1); --- step exp Int ---> --- step exp Int ---> --- step exp Int ---> -10: type error in call -expected: Int -actual: Tuple(0 = Int) -EXIT CODE: 255 + +********** type checking complete ********** +fn f (0 = Int: x) -> Int { +return (x - 1); +} +fn main () -> Int { +return f(0 = 1); +} +********** starting execution ********** +********** initializing globals ********** +--- step exp (0 = Int: x) ---> +--- step exp Int: x ---> +--- step exp Int ---> +--- handle value Int with Int: x<1>(Int,) ---> +--- handle value Int: x with (0 = Int: x)<1>(Int: x,) ---> +--- step exp () ---> +********** calling main function ********** +{ +stack: top{main()<-1>} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp main() ---> +{ +stack: top{main<-1> :: main()<0>} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp main ---> +{ +stack: top{fun
<-1> :: main()<0>} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value fun
with main()<1>(fun
,) ---> +{ +stack: top{()<-1> :: main()<1>(fun
,)} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp () ---> +{ +stack: top{()<-1> :: main()<1>(fun
,)} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value () with main()<2>(fun
,(),) ---> +pattern_match((), ()) +{ +stack: main{return f(0 = 1);<-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step stmt return f(0 = 1); ---> +{ +stack: main{f(0 = 1)<-1> :: return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp f(0 = 1) ---> +{ +stack: main{f<-1> :: f(0 = 1)<0> :: return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp f ---> +{ +stack: main{fun<-1> :: f(0 = 1)<0> :: return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value fun with f(0 = 1)<1>(fun,) ---> +{ +stack: main{(0 = 1)<-1> :: f(0 = 1)<1>(fun,) :: return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp (0 = 1) ---> +{ +stack: main{1<-1> :: (0 = 1)<0> :: f(0 = 1)<1>(fun,) :: return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp 1 ---> +{ +stack: main{1<-1> :: (0 = 1)<0> :: f(0 = 1)<1>(fun,) :: return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value 1 with (0 = 1)<1>(1,) ---> +{ +stack: main{(0 = 1@3)<-1> :: f(0 = 1)<1>(fun,) :: return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, 1, +env: main: fun
, f: fun, +} +--- handle value (0 = 1@3) with f(0 = 1)<2>(fun,(0 = 1@3),) ---> +pattern_match((0 = Int: x@0), (0 = 1@3)) +pattern_match(Int: x, 1) +{ +stack: f{return (x - 1);<-1>} :: main{return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step stmt return (x - 1); ---> +{ +stack: f{(x - 1)<-1> :: return (x - 1);<0>} :: main{return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp (x - 1) ---> +{ +stack: f{x<-1> :: (x - 1)<0> :: return (x - 1);<0>} :: main{return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp x ---> +{ +stack: f{1<-1> :: (x - 1)<0> :: return (x - 1);<0>} :: main{return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- handle value 1 with (x - 1)<1>(1,) ---> +{ +stack: f{1<-1> :: (x - 1)<1>(1,) :: return (x - 1);<0>} :: main{return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp 1 ---> +{ +stack: f{1<-1> :: (x - 1)<1>(1,) :: return (x - 1);<0>} :: main{return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- handle value 1 with (x - 1)<2>(1,1,) ---> +{ +stack: f{0<-1> :: return (x - 1);<0>} :: main{return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- handle value 0 with return (x - 1);<1>(0,) ---> +{ +stack: main{0<-1> :: return f(0 = 1);<0>} :: top{} +heap: Int: x, fun, fun
, 1, !!1, +env: main: fun
, f: fun, +} +--- handle value 0 with return f(0 = 1);<1>(0,) ---> +{ +stack: top{0<-1>} +heap: Int: x, fun, fun
, 1, !!1, +env: main: fun
, f: fun, +} +result: 0 diff --git a/executable_semantics/testdata/fun2.golden b/executable_semantics/testdata/fun2.golden index 9c440fa9482c..421e6ce5f9c2 100644 --- a/executable_semantics/testdata/fun2.golden +++ b/executable_semantics/testdata/fun2.golden @@ -1,5 +1,5 @@ ********** source program ********** -fn f Int: x -> Int { +fn f (0 = Int: x) -> Int { return 0; } @@ -20,7 +20,293 @@ return b; --- step exp Int ---> --- step exp Int ---> --- step exp Int ---> -15: type error in call -expected: Int -actual: Tuple(0 = Int) -EXIT CODE: 255 + +********** type checking complete ********** +fn f (0 = Int: x) -> Int { +return 0; +} +fn main () -> Int { +var Int: a = 0; +var Int: b = 1; +f(0 = a); +b = a; +return b; +} +********** starting execution ********** +********** initializing globals ********** +--- step exp (0 = Int: x) ---> +--- step exp Int: x ---> +--- step exp Int ---> +--- handle value Int with Int: x<1>(Int,) ---> +--- handle value Int: x with (0 = Int: x)<1>(Int: x,) ---> +--- step exp () ---> +********** calling main function ********** +{ +stack: top{main()<-1>} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp main() ---> +{ +stack: top{main<-1> :: main()<0>} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp main ---> +{ +stack: top{fun
<-1> :: main()<0>} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value fun
with main()<1>(fun
,) ---> +{ +stack: top{()<-1> :: main()<1>(fun
,)} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp () ---> +{ +stack: top{()<-1> :: main()<1>(fun
,)} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value () with main()<2>(fun
,(),) ---> +pattern_match((), ()) +{ +stack: main{var Int: a = 0; ... <-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step stmt var Int: a = 0; ... ---> +{ +stack: main{var Int: a = 0;<-1> :: var Int: b = 1; ... <-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step stmt var Int: a = 0; ---> +{ +stack: main{0<-1> :: var Int: a = 0;<0> :: var Int: b = 1; ... <-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp 0 ---> +{ +stack: main{0<-1> :: var Int: a = 0;<0> :: var Int: b = 1; ... <-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value 0 with var Int: a = 0;<1>(0,) ---> +{ +stack: main{Int: a<-1> :: var Int: a = 0;<1>(0,) :: var Int: b = 1; ... <-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp Int: a ---> +{ +stack: main{Int<-1> :: Int: a<0> :: var Int: a = 0;<1>(0,) :: var Int: b = 1; ... <-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp Int ---> +{ +stack: main{Int<-1> :: Int: a<0> :: var Int: a = 0;<1>(0,) :: var Int: b = 1; ... <-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value Int with Int: a<1>(Int,) ---> +{ +stack: main{Int: a<-1> :: var Int: a = 0;<1>(0,) :: var Int: b = 1; ... <-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value Int: a with var Int: a = 0;<2>(0,Int: a,) ---> +pattern_match(Int: a, 0) +{ +stack: main{var Int: b = 1; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, +env: a: 0, main: fun
, f: fun, +} +--- step stmt var Int: b = 1; ... ---> +{ +stack: main{var Int: b = 1;<-1> :: f(0 = a); ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, +env: a: 0, main: fun
, f: fun, +} +--- step stmt var Int: b = 1; ---> +{ +stack: main{1<-1> :: var Int: b = 1;<0> :: f(0 = a); ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, +env: a: 0, main: fun
, f: fun, +} +--- step exp 1 ---> +{ +stack: main{1<-1> :: var Int: b = 1;<0> :: f(0 = a); ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, +env: a: 0, main: fun
, f: fun, +} +--- handle value 1 with var Int: b = 1;<1>(1,) ---> +{ +stack: main{Int: b<-1> :: var Int: b = 1;<1>(1,) :: f(0 = a); ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, +env: a: 0, main: fun
, f: fun, +} +--- step exp Int: b ---> +{ +stack: main{Int<-1> :: Int: b<0> :: var Int: b = 1;<1>(1,) :: f(0 = a); ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, +env: a: 0, main: fun
, f: fun, +} +--- step exp Int ---> +{ +stack: main{Int<-1> :: Int: b<0> :: var Int: b = 1;<1>(1,) :: f(0 = a); ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, +env: a: 0, main: fun
, f: fun, +} +--- handle value Int with Int: b<1>(Int,) ---> +{ +stack: main{Int: b<-1> :: var Int: b = 1;<1>(1,) :: f(0 = a); ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, +env: a: 0, main: fun
, f: fun, +} +--- handle value Int: b with var Int: b = 1;<2>(1,Int: b,) ---> +pattern_match(Int: b, 1) +{ +stack: main{f(0 = a); ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- step stmt f(0 = a); ... ---> +{ +stack: main{f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- step stmt f(0 = a); ---> +{ +stack: main{f(0 = a)<-1> :: f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- step exp f(0 = a) ---> +{ +stack: main{f<-1> :: f(0 = a)<0> :: f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- step exp f ---> +{ +stack: main{fun<-1> :: f(0 = a)<0> :: f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- handle value fun with f(0 = a)<1>(fun,) ---> +{ +stack: main{(0 = a)<-1> :: f(0 = a)<1>(fun,) :: f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- step exp (0 = a) ---> +{ +stack: main{a<-1> :: (0 = a)<0> :: f(0 = a)<1>(fun,) :: f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- step exp a ---> +{ +stack: main{0<-1> :: (0 = a)<0> :: f(0 = a)<1>(fun,) :: f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- handle value 0 with (0 = a)<1>(0,) ---> +{ +stack: main{(0 = 0@5)<-1> :: f(0 = a)<1>(fun,) :: f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, 0, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- handle value (0 = 0@5) with f(0 = a)<2>(fun,(0 = 0@5),) ---> +pattern_match((0 = Int: x@0), (0 = 0@5)) +pattern_match(Int: x, 0) +{ +stack: f{return 0;<-1>} :: main{f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- step stmt return 0; ---> +{ +stack: f{0<-1> :: return 0;<0>} :: main{f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- step exp 0 ---> +{ +stack: f{0<-1> :: return 0;<0>} :: main{f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- handle value 0 with return 0;<1>(0,) ---> +{ +stack: main{0<-1> :: f(0 = a);<-1> :: b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, 0, !!0, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- handle value 0 with f(0 = a);<0>(0,) ---> +{ +stack: main{b = a; ... <-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, 0, !!0, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- step stmt b = a; ... ---> +{ +stack: main{b = a;<-1> :: return b;<-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, 0, !!0, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- step stmt b = a; ---> +{ +stack: main{b<-1> :: b = a;<0> :: return b;<-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, 0, !!0, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- step lvalue b ---> +{ +stack: main{ptr<4><-1> :: b = a;<0> :: return b;<-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, 0, !!0, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- handle value ptr<4> with b = a;<1>(ptr<4>,) ---> +{ +stack: main{a<-1> :: b = a;<1>(ptr<4>,) :: return b;<-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, 0, !!0, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- step exp a ---> +{ +stack: main{0<-1> :: b = a;<1>(ptr<4>,) :: return b;<-1>} :: top{} +heap: Int: x, fun, fun
, 0, 1, 0, !!0, +env: b: 1, a: 0, main: fun
, f: fun, +} +--- handle value 0 with b = a;<2>(ptr<4>,0,) ---> +{ +stack: main{return b;<-1>} :: top{} +heap: Int: x, fun, fun
, 0, 0, 0, !!0, +env: b: 0, a: 0, main: fun
, f: fun, +} +--- step stmt return b; ---> +{ +stack: main{b<-1> :: return b;<0>} :: top{} +heap: Int: x, fun, fun
, 0, 0, 0, !!0, +env: b: 0, a: 0, main: fun
, f: fun, +} +--- step exp b ---> +{ +stack: main{0<-1> :: return b;<0>} :: top{} +heap: Int: x, fun, fun
, 0, 0, 0, !!0, +env: b: 0, a: 0, main: fun
, f: fun, +} +--- handle value 0 with return b;<1>(0,) ---> +{ +stack: top{0<-1>} +heap: Int: x, fun, fun
, !!0, !!0, !!0, !!0, +env: main: fun
, f: fun, +} +result: 0 diff --git a/executable_semantics/testdata/fun_recur.golden b/executable_semantics/testdata/fun_recur.golden index 783bf684ae0c..d305571cd5fa 100644 --- a/executable_semantics/testdata/fun_recur.golden +++ b/executable_semantics/testdata/fun_recur.golden @@ -1,5 +1,5 @@ ********** source program ********** -fn f Int: x -> Int { +fn f (0 = Int: x) -> Int { if ((x == 0)) return x; else @@ -16,7 +16,502 @@ return f(0 = 2); --- step exp Int ---> --- step exp Int ---> --- step exp Int ---> -9: type error in call -expected: Int -actual: Tuple(0 = Int) -EXIT CODE: 255 +--- step exp Int ---> + +********** type checking complete ********** +fn f (0 = Int: x) -> Int { +if ((x == 0)) +return x; +else +return f(0 = (x - 1)); +} +fn main () -> Int { +return f(0 = 2); +} +********** starting execution ********** +********** initializing globals ********** +--- step exp (0 = Int: x) ---> +--- step exp Int: x ---> +--- step exp Int ---> +--- handle value Int with Int: x<1>(Int,) ---> +--- handle value Int: x with (0 = Int: x)<1>(Int: x,) ---> +--- step exp () ---> +********** calling main function ********** +{ +stack: top{main()<-1>} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp main() ---> +{ +stack: top{main<-1> :: main()<0>} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp main ---> +{ +stack: top{fun
<-1> :: main()<0>} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value fun
with main()<1>(fun
,) ---> +{ +stack: top{()<-1> :: main()<1>(fun
,)} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp () ---> +{ +stack: top{()<-1> :: main()<1>(fun
,)} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value () with main()<2>(fun
,(),) ---> +pattern_match((), ()) +{ +stack: main{return f(0 = 2);<-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step stmt return f(0 = 2); ---> +{ +stack: main{f(0 = 2)<-1> :: return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp f(0 = 2) ---> +{ +stack: main{f<-1> :: f(0 = 2)<0> :: return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp f ---> +{ +stack: main{fun<-1> :: f(0 = 2)<0> :: return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value fun with f(0 = 2)<1>(fun,) ---> +{ +stack: main{(0 = 2)<-1> :: f(0 = 2)<1>(fun,) :: return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp (0 = 2) ---> +{ +stack: main{2<-1> :: (0 = 2)<0> :: f(0 = 2)<1>(fun,) :: return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- step exp 2 ---> +{ +stack: main{2<-1> :: (0 = 2)<0> :: f(0 = 2)<1>(fun,) :: return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, f: fun, +} +--- handle value 2 with (0 = 2)<1>(2,) ---> +{ +stack: main{(0 = 2@3)<-1> :: f(0 = 2)<1>(fun,) :: return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, +env: main: fun
, f: fun, +} +--- handle value (0 = 2@3) with f(0 = 2)<2>(fun,(0 = 2@3),) ---> +pattern_match((0 = Int: x@0), (0 = 2@3)) +pattern_match(Int: x, 2) +{ +stack: f{if ((x == 0)) + ... +else + ... <-1>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- step stmt if ((x == 0)) + ... +else + ... ---> +{ +stack: f{(x == 0)<-1> :: if ((x == 0)) + ... +else + ... <0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- step exp (x == 0) ---> +{ +stack: f{x<-1> :: (x == 0)<0> :: if ((x == 0)) + ... +else + ... <0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- step exp x ---> +{ +stack: f{2<-1> :: (x == 0)<0> :: if ((x == 0)) + ... +else + ... <0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- handle value 2 with (x == 0)<1>(2,) ---> +{ +stack: f{0<-1> :: (x == 0)<1>(2,) :: if ((x == 0)) + ... +else + ... <0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- step exp 0 ---> +{ +stack: f{0<-1> :: (x == 0)<1>(2,) :: if ((x == 0)) + ... +else + ... <0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- handle value 0 with (x == 0)<2>(2,0,) ---> +{ +stack: f{false<-1> :: if ((x == 0)) + ... +else + ... <0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- handle value false with if ((x == 0)) + ... +else + ... <1>(false,) ---> +{ +stack: f{return f(0 = (x - 1));<-1>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- step stmt return f(0 = (x - 1)); ---> +{ +stack: f{f(0 = (x - 1))<-1> :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- step exp f(0 = (x - 1)) ---> +{ +stack: f{f<-1> :: f(0 = (x - 1))<0> :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- step exp f ---> +{ +stack: f{fun<-1> :: f(0 = (x - 1))<0> :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- handle value fun with f(0 = (x - 1))<1>(fun,) ---> +{ +stack: f{(0 = (x - 1))<-1> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- step exp (0 = (x - 1)) ---> +{ +stack: f{(x - 1)<-1> :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- step exp (x - 1) ---> +{ +stack: f{x<-1> :: (x - 1)<0> :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- step exp x ---> +{ +stack: f{2<-1> :: (x - 1)<0> :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- handle value 2 with (x - 1)<1>(2,) ---> +{ +stack: f{1<-1> :: (x - 1)<1>(2,) :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- step exp 1 ---> +{ +stack: f{1<-1> :: (x - 1)<1>(2,) :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- handle value 1 with (x - 1)<2>(2,1,) ---> +{ +stack: f{1<-1> :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, +env: x: 2, main: fun
, f: fun, +} +--- handle value 1 with (0 = (x - 1))<1>(1,) ---> +{ +stack: f{(0 = 1@5)<-1> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, +env: x: 2, main: fun
, f: fun, +} +--- handle value (0 = 1@5) with f(0 = (x - 1))<2>(fun,(0 = 1@5),) ---> +pattern_match((0 = Int: x@0), (0 = 1@5)) +pattern_match(Int: x, 1) +{ +stack: f{if ((x == 0)) + ... +else + ... <-1>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step stmt if ((x == 0)) + ... +else + ... ---> +{ +stack: f{(x == 0)<-1> :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp (x == 0) ---> +{ +stack: f{x<-1> :: (x == 0)<0> :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp x ---> +{ +stack: f{1<-1> :: (x == 0)<0> :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- handle value 1 with (x == 0)<1>(1,) ---> +{ +stack: f{0<-1> :: (x == 0)<1>(1,) :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp 0 ---> +{ +stack: f{0<-1> :: (x == 0)<1>(1,) :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- handle value 0 with (x == 0)<2>(1,0,) ---> +{ +stack: f{false<-1> :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- handle value false with if ((x == 0)) + ... +else + ... <1>(false,) ---> +{ +stack: f{return f(0 = (x - 1));<-1>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step stmt return f(0 = (x - 1)); ---> +{ +stack: f{f(0 = (x - 1))<-1> :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp f(0 = (x - 1)) ---> +{ +stack: f{f<-1> :: f(0 = (x - 1))<0> :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp f ---> +{ +stack: f{fun<-1> :: f(0 = (x - 1))<0> :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- handle value fun with f(0 = (x - 1))<1>(fun,) ---> +{ +stack: f{(0 = (x - 1))<-1> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp (0 = (x - 1)) ---> +{ +stack: f{(x - 1)<-1> :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp (x - 1) ---> +{ +stack: f{x<-1> :: (x - 1)<0> :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp x ---> +{ +stack: f{1<-1> :: (x - 1)<0> :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- handle value 1 with (x - 1)<1>(1,) ---> +{ +stack: f{1<-1> :: (x - 1)<1>(1,) :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- step exp 1 ---> +{ +stack: f{1<-1> :: (x - 1)<1>(1,) :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- handle value 1 with (x - 1)<2>(1,1,) ---> +{ +stack: f{0<-1> :: (0 = (x - 1))<0> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, +env: x: 1, main: fun
, f: fun, +} +--- handle value 0 with (0 = (x - 1))<1>(0,) ---> +{ +stack: f{(0 = 0@7)<-1> :: f(0 = (x - 1))<1>(fun,) :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, +env: x: 1, main: fun
, f: fun, +} +--- handle value (0 = 0@7) with f(0 = (x - 1))<2>(fun,(0 = 0@7),) ---> +pattern_match((0 = Int: x@0), (0 = 0@7)) +pattern_match(Int: x, 0) +{ +stack: f{if ((x == 0)) + ... +else + ... <-1>} :: f{return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- step stmt if ((x == 0)) + ... +else + ... ---> +{ +stack: f{(x == 0)<-1> :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- step exp (x == 0) ---> +{ +stack: f{x<-1> :: (x == 0)<0> :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- step exp x ---> +{ +stack: f{0<-1> :: (x == 0)<0> :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- handle value 0 with (x == 0)<1>(0,) ---> +{ +stack: f{0<-1> :: (x == 0)<1>(0,) :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- step exp 0 ---> +{ +stack: f{0<-1> :: (x == 0)<1>(0,) :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- handle value 0 with (x == 0)<2>(0,0,) ---> +{ +stack: f{true<-1> :: if ((x == 0)) + ... +else + ... <0>} :: f{return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- handle value true with if ((x == 0)) + ... +else + ... <1>(true,) ---> +{ +stack: f{return x;<-1>} :: f{return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- step stmt return x; ---> +{ +stack: f{x<-1> :: return x;<0>} :: f{return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- step exp x ---> +{ +stack: f{0<-1> :: return x;<0>} :: f{return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, 0, +env: x: 0, main: fun
, f: fun, +} +--- handle value 0 with return x;<1>(0,) ---> +{ +stack: f{0<-1> :: return f(0 = (x - 1));<0>} :: f{return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, 1, 0, !!0, +env: x: 1, main: fun
, f: fun, +} +--- handle value 0 with return f(0 = (x - 1));<1>(0,) ---> +{ +stack: f{0<-1> :: return f(0 = (x - 1));<0>} :: main{return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, 2, 1, !!1, 0, !!0, +env: x: 2, main: fun
, f: fun, +} +--- handle value 0 with return f(0 = (x - 1));<1>(0,) ---> +{ +stack: main{0<-1> :: return f(0 = 2);<0>} :: top{} +heap: Int: x, fun, fun
, 2, !!2, 1, !!1, 0, !!0, +env: main: fun
, f: fun, +} +--- handle value 0 with return f(0 = 2);<1>(0,) ---> +{ +stack: top{0<-1>} +heap: Int: x, fun, fun
, 2, !!2, 1, !!1, 0, !!0, +env: main: fun
, f: fun, +} +result: 0 diff --git a/executable_semantics/testdata/funptr1.golden b/executable_semantics/testdata/funptr1.golden index b4ee8bfcb6bd..c5bf12ded2c2 100644 --- a/executable_semantics/testdata/funptr1.golden +++ b/executable_semantics/testdata/funptr1.golden @@ -1,10 +1,10 @@ ********** source program ********** -fn add1 Int: x -> Int { +fn add1 (0 = Int: x) -> Int { return (x + 1); } fn main () -> Int { -var fn Int -> Int: f = add1; +var fn (0 = Int) -> Int: f = add1; return f(0 = (- 1)); } @@ -15,12 +15,260 @@ return f(0 = (- 1)); --- step exp Int ---> --- step exp Int ---> --- step exp Int ---> ---- step exp fn Int -> Int ---> +--- step exp fn (0 = Int) -> Int ---> +--- step exp (0 = Int) ---> --- step exp Int ---> ---- handle value Int with fn Int -> Int<1>(Int,) ---> +--- handle value Int with (0 = Int)<1>(Int,) ---> +--- handle value (0 = Int@0) with fn (0 = Int) -> Int<1>((0 = Int@0),) ---> --- step exp Int ---> ---- handle value Int with fn Int -> Int<2>(Int,Int,) ---> -11: type error in call -expected: Int -actual: Tuple(0 = Int) -EXIT CODE: 255 +--- handle value Int with fn (0 = Int) -> Int<2>((0 = Int@0),Int,) ---> + +********** type checking complete ********** +fn add1 (0 = Int: x) -> Int { +return (x + 1); +} +fn main () -> Int { +var fn (0 = Int) -> Int: f = add1; +return f(0 = (- 1)); +} +********** starting execution ********** +********** initializing globals ********** +--- step exp (0 = Int: x) ---> +--- step exp Int: x ---> +--- step exp Int ---> +--- handle value Int with Int: x<1>(Int,) ---> +--- handle value Int: x with (0 = Int: x)<1>(Int: x,) ---> +--- step exp () ---> +********** calling main function ********** +{ +stack: top{main()<-1>} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- step exp main() ---> +{ +stack: top{main<-1> :: main()<0>} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- step exp main ---> +{ +stack: top{fun
<-1> :: main()<0>} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- handle value fun
with main()<1>(fun
,) ---> +{ +stack: top{()<-1> :: main()<1>(fun
,)} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- step exp () ---> +{ +stack: top{()<-1> :: main()<1>(fun
,)} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- handle value () with main()<2>(fun
,(),) ---> +pattern_match((), ()) +{ +stack: main{var fn (0 = Int) -> Int: f = add1; ... <-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- step stmt var fn (0 = Int) -> Int: f = add1; ... ---> +{ +stack: main{var fn (0 = Int) -> Int: f = add1;<-1> :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- step stmt var fn (0 = Int) -> Int: f = add1; ---> +{ +stack: main{add1<-1> :: var fn (0 = Int) -> Int: f = add1;<0> :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- step exp add1 ---> +{ +stack: main{fun<-1> :: var fn (0 = Int) -> Int: f = add1;<0> :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- handle value fun with var fn (0 = Int) -> Int: f = add1;<1>(fun,) ---> +{ +stack: main{fn (0 = Int) -> Int: f<-1> :: var fn (0 = Int) -> Int: f = add1;<1>(fun,) :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- step exp fn (0 = Int) -> Int: f ---> +{ +stack: main{fn (0 = Int) -> Int<-1> :: fn (0 = Int) -> Int: f<0> :: var fn (0 = Int) -> Int: f = add1;<1>(fun,) :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- step exp fn (0 = Int) -> Int ---> +{ +stack: main{(0 = Int)<-1> :: fn (0 = Int) -> Int<0> :: fn (0 = Int) -> Int: f<0> :: var fn (0 = Int) -> Int: f = add1;<1>(fun,) :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- step exp (0 = Int) ---> +{ +stack: main{Int<-1> :: (0 = Int)<0> :: fn (0 = Int) -> Int<0> :: fn (0 = Int) -> Int: f<0> :: var fn (0 = Int) -> Int: f = add1;<1>(fun,) :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- step exp Int ---> +{ +stack: main{Int<-1> :: (0 = Int)<0> :: fn (0 = Int) -> Int<0> :: fn (0 = Int) -> Int: f<0> :: var fn (0 = Int) -> Int: f = add1;<1>(fun,) :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, +env: main: fun
, add1: fun, +} +--- handle value Int with (0 = Int)<1>(Int,) ---> +{ +stack: main{(0 = Int@3)<-1> :: fn (0 = Int) -> Int<0> :: fn (0 = Int) -> Int: f<0> :: var fn (0 = Int) -> Int: f = add1;<1>(fun,) :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, Int, +env: main: fun
, add1: fun, +} +--- handle value (0 = Int@3) with fn (0 = Int) -> Int<1>((0 = Int@3),) ---> +{ +stack: main{Int<-1> :: fn (0 = Int) -> Int<1>((0 = Int@3),) :: fn (0 = Int) -> Int: f<0> :: var fn (0 = Int) -> Int: f = add1;<1>(fun,) :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, Int, +env: main: fun
, add1: fun, +} +--- step exp Int ---> +{ +stack: main{Int<-1> :: fn (0 = Int) -> Int<1>((0 = Int@3),) :: fn (0 = Int) -> Int: f<0> :: var fn (0 = Int) -> Int: f = add1;<1>(fun,) :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, Int, +env: main: fun
, add1: fun, +} +--- handle value Int with fn (0 = Int) -> Int<2>((0 = Int@3),Int,) ---> +{ +stack: main{fn (0 = Int@3) -> Int<-1> :: fn (0 = Int) -> Int: f<0> :: var fn (0 = Int) -> Int: f = add1;<1>(fun,) :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, Int, +env: main: fun
, add1: fun, +} +--- handle value fn (0 = Int@3) -> Int with fn (0 = Int) -> Int: f<1>(fn (0 = Int@3) -> Int,) ---> +{ +stack: main{fn (0 = Int@3) -> Int: f<-1> :: var fn (0 = Int) -> Int: f = add1;<1>(fun,) :: return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, Int, +env: main: fun
, add1: fun, +} +--- handle value fn (0 = Int@3) -> Int: f with var fn (0 = Int) -> Int: f = add1;<2>(fun,fn (0 = Int@3) -> Int: f,) ---> +pattern_match(fn (0 = Int@3) -> Int: f, fun) +{ +stack: main{return f(0 = (- 1));<-1>} :: top{} +heap: Int: x, fun, fun
, Int, fun, +env: f: fun, main: fun
, add1: fun, +} +--- step stmt return f(0 = (- 1)); ---> +{ +stack: main{f(0 = (- 1))<-1> :: return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, +env: f: fun, main: fun
, add1: fun, +} +--- step exp f(0 = (- 1)) ---> +{ +stack: main{f<-1> :: f(0 = (- 1))<0> :: return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, +env: f: fun, main: fun
, add1: fun, +} +--- step exp f ---> +{ +stack: main{fun<-1> :: f(0 = (- 1))<0> :: return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, +env: f: fun, main: fun
, add1: fun, +} +--- handle value fun with f(0 = (- 1))<1>(fun,) ---> +{ +stack: main{(0 = (- 1))<-1> :: f(0 = (- 1))<1>(fun,) :: return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, +env: f: fun, main: fun
, add1: fun, +} +--- step exp (0 = (- 1)) ---> +{ +stack: main{(- 1)<-1> :: (0 = (- 1))<0> :: f(0 = (- 1))<1>(fun,) :: return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, +env: f: fun, main: fun
, add1: fun, +} +--- step exp (- 1) ---> +{ +stack: main{1<-1> :: (- 1)<0> :: (0 = (- 1))<0> :: f(0 = (- 1))<1>(fun,) :: return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, +env: f: fun, main: fun
, add1: fun, +} +--- step exp 1 ---> +{ +stack: main{1<-1> :: (- 1)<0> :: (0 = (- 1))<0> :: f(0 = (- 1))<1>(fun,) :: return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, +env: f: fun, main: fun
, add1: fun, +} +--- handle value 1 with (- 1)<1>(1,) ---> +{ +stack: main{-1<-1> :: (0 = (- 1))<0> :: f(0 = (- 1))<1>(fun,) :: return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, +env: f: fun, main: fun
, add1: fun, +} +--- handle value -1 with (0 = (- 1))<1>(-1,) ---> +{ +stack: main{(0 = -1@5)<-1> :: f(0 = (- 1))<1>(fun,) :: return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, -1, +env: f: fun, main: fun
, add1: fun, +} +--- handle value (0 = -1@5) with f(0 = (- 1))<2>(fun,(0 = -1@5),) ---> +pattern_match((0 = Int: x@0), (0 = -1@5)) +pattern_match(Int: x, -1) +{ +stack: add1{return (x + 1);<-1>} :: main{return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, -1, -1, +env: x: -1, main: fun
, add1: fun, +} +--- step stmt return (x + 1); ---> +{ +stack: add1{(x + 1)<-1> :: return (x + 1);<0>} :: main{return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, -1, -1, +env: x: -1, main: fun
, add1: fun, +} +--- step exp (x + 1) ---> +{ +stack: add1{x<-1> :: (x + 1)<0> :: return (x + 1);<0>} :: main{return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, -1, -1, +env: x: -1, main: fun
, add1: fun, +} +--- step exp x ---> +{ +stack: add1{-1<-1> :: (x + 1)<0> :: return (x + 1);<0>} :: main{return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, -1, -1, +env: x: -1, main: fun
, add1: fun, +} +--- handle value -1 with (x + 1)<1>(-1,) ---> +{ +stack: add1{1<-1> :: (x + 1)<1>(-1,) :: return (x + 1);<0>} :: main{return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, -1, -1, +env: x: -1, main: fun
, add1: fun, +} +--- step exp 1 ---> +{ +stack: add1{1<-1> :: (x + 1)<1>(-1,) :: return (x + 1);<0>} :: main{return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, -1, -1, +env: x: -1, main: fun
, add1: fun, +} +--- handle value 1 with (x + 1)<2>(-1,1,) ---> +{ +stack: add1{0<-1> :: return (x + 1);<0>} :: main{return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, -1, -1, +env: x: -1, main: fun
, add1: fun, +} +--- handle value 0 with return (x + 1);<1>(0,) ---> +{ +stack: main{0<-1> :: return f(0 = (- 1));<0>} :: top{} +heap: Int: x, fun, fun
, Int, fun, -1, !!-1, +env: f: fun, main: fun
, add1: fun, +} +--- handle value 0 with return f(0 = (- 1));<1>(0,) ---> +{ +stack: top{0<-1>} +heap: Int: x, fun, fun
, Int, !!fun, -1, !!-1, +env: main: fun
, add1: fun, +} +result: 0