break1.golden 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. MakeBlock
  2. ********** source program **********
  3. fn main () -> Int {
  4. var Int: x = 2;
  5. while (true)
  6. {
  7. if ((x == 0))
  8. break;
  9. else
  10. x = (x - 1);
  11. }
  12. return x;
  13. }
  14. ********** type checking **********
  15. --- step exp Int --->
  16. --- step exp Int --->
  17. --- step exp Int --->
  18. ********** type checking complete **********
  19. fn main () -> Int {
  20. var Int: x = 2;
  21. while (true)
  22. {
  23. if ((x == 0))
  24. break;
  25. else
  26. x = (x - 1);
  27. }
  28. return x;
  29. }
  30. ********** starting execution **********
  31. ********** initializing globals **********
  32. --- step exp () --->
  33. ********** calling main function **********
  34. {
  35. stack: top{main()<-1>}
  36. heap: fun<main>,
  37. env: main: fun<main>,
  38. }
  39. --- step exp main() --->
  40. {
  41. stack: top{main<-1> :: main()<0>}
  42. heap: fun<main>,
  43. env: main: fun<main>,
  44. }
  45. --- step exp main --->
  46. {
  47. stack: top{fun<main><-1> :: main()<0>}
  48. heap: fun<main>,
  49. env: main: fun<main>,
  50. }
  51. --- handle value fun<main> with main()<1>(fun<main>,) --->
  52. {
  53. stack: top{()<-1> :: main()<1>(fun<main>,)}
  54. heap: fun<main>,
  55. env: main: fun<main>,
  56. }
  57. --- step exp () --->
  58. {
  59. stack: top{()<-1> :: main()<1>(fun<main>,)}
  60. heap: fun<main>,
  61. env: main: fun<main>,
  62. }
  63. --- handle value () with main()<2>(fun<main>,(),) --->
  64. pattern_match((), ())
  65. {
  66. stack: main{var Int: x = 2; ... <-1>} :: top{}
  67. heap: fun<main>,
  68. env: main: fun<main>,
  69. }
  70. --- step stmt var Int: x = 2; ... --->
  71. {
  72. stack: main{var Int: x = 2;<-1> :: while (true)
  73. ... ... <-1>} :: top{}
  74. heap: fun<main>,
  75. env: main: fun<main>,
  76. }
  77. --- step stmt var Int: x = 2; --->
  78. {
  79. stack: main{2<-1> :: var Int: x = 2;<0> :: while (true)
  80. ... ... <-1>} :: top{}
  81. heap: fun<main>,
  82. env: main: fun<main>,
  83. }
  84. --- step exp 2 --->
  85. {
  86. stack: main{2<-1> :: var Int: x = 2;<0> :: while (true)
  87. ... ... <-1>} :: top{}
  88. heap: fun<main>,
  89. env: main: fun<main>,
  90. }
  91. --- handle value 2 with var Int: x = 2;<1>(2,) --->
  92. {
  93. stack: main{Int: x<-1> :: var Int: x = 2;<1>(2,) :: while (true)
  94. ... ... <-1>} :: top{}
  95. heap: fun<main>,
  96. env: main: fun<main>,
  97. }
  98. --- step exp Int: x --->
  99. {
  100. stack: main{Int<-1> :: Int: x<0> :: var Int: x = 2;<1>(2,) :: while (true)
  101. ... ... <-1>} :: top{}
  102. heap: fun<main>,
  103. env: main: fun<main>,
  104. }
  105. --- step exp Int --->
  106. {
  107. stack: main{Int<-1> :: Int: x<0> :: var Int: x = 2;<1>(2,) :: while (true)
  108. ... ... <-1>} :: top{}
  109. heap: fun<main>,
  110. env: main: fun<main>,
  111. }
  112. --- handle value Int with Int: x<1>(Int,) --->
  113. {
  114. stack: main{Int: x<-1> :: var Int: x = 2;<1>(2,) :: while (true)
  115. ... ... <-1>} :: top{}
  116. heap: fun<main>,
  117. env: main: fun<main>,
  118. }
  119. --- handle value Int: x with var Int: x = 2;<2>(2,Int: x,) --->
  120. pattern_match(Int: x, 2)
  121. {
  122. stack: main{while (true)
  123. ... ... <-1>} :: top{}
  124. heap: fun<main>, 2,
  125. env: x: 2, main: fun<main>,
  126. }
  127. --- step stmt while (true)
  128. ... ... --->
  129. {
  130. stack: main{while (true)
  131. ... <-1> :: return x;<-1>} :: top{}
  132. heap: fun<main>, 2,
  133. env: x: 2, main: fun<main>,
  134. }
  135. --- step stmt while (true)
  136. ... --->
  137. {
  138. stack: main{true<-1> :: while (true)
  139. ... <0> :: return x;<-1>} :: top{}
  140. heap: fun<main>, 2,
  141. env: x: 2, main: fun<main>,
  142. }
  143. --- step exp true --->
  144. {
  145. stack: main{true<-1> :: while (true)
  146. ... <0> :: return x;<-1>} :: top{}
  147. heap: fun<main>, 2,
  148. env: x: 2, main: fun<main>,
  149. }
  150. --- handle value true with while (true)
  151. ... <1>(true,) --->
  152. {
  153. stack: main{{
  154. ...
  155. }
  156. <-1> :: while (true)
  157. ... <-1> :: return x;<-1>} :: top{}
  158. heap: fun<main>, 2,
  159. env: x: 2, main: fun<main>,
  160. }
  161. --- step stmt {
  162. ...
  163. }
  164. --->
  165. {
  166. stack: main{if ((x == 0))
  167. ...
  168. else
  169. ... <-1> :: {
  170. ...
  171. }
  172. <0> :: while (true)
  173. ... <-1> :: return x;<-1>} :: top{}
  174. heap: fun<main>, 2,
  175. env: x: 2, main: fun<main>,
  176. }
  177. --- step stmt if ((x == 0))
  178. ...
  179. else
  180. ... --->
  181. {
  182. stack: main{if ((x == 0))
  183. ...
  184. else
  185. ... <-1> :: {
  186. ...
  187. }
  188. <0> :: while (true)
  189. ... <-1> :: return x;<-1>} :: top{}
  190. heap: fun<main>, 2,
  191. env: x: 2, main: fun<main>,
  192. }
  193. --- step stmt if ((x == 0))
  194. ...
  195. else
  196. ... --->
  197. {
  198. stack: main{(x == 0)<-1> :: if ((x == 0))
  199. ...
  200. else
  201. ... <0> :: {
  202. ...
  203. }
  204. <0> :: while (true)
  205. ... <-1> :: return x;<-1>} :: top{}
  206. heap: fun<main>, 2,
  207. env: x: 2, main: fun<main>,
  208. }
  209. --- step exp (x == 0) --->
  210. {
  211. stack: main{x<-1> :: (x == 0)<0> :: if ((x == 0))
  212. ...
  213. else
  214. ... <0> :: {
  215. ...
  216. }
  217. <0> :: while (true)
  218. ... <-1> :: return x;<-1>} :: top{}
  219. heap: fun<main>, 2,
  220. env: x: 2, main: fun<main>,
  221. }
  222. --- step exp x --->
  223. {
  224. stack: main{2<-1> :: (x == 0)<0> :: if ((x == 0))
  225. ...
  226. else
  227. ... <0> :: {
  228. ...
  229. }
  230. <0> :: while (true)
  231. ... <-1> :: return x;<-1>} :: top{}
  232. heap: fun<main>, 2,
  233. env: x: 2, main: fun<main>,
  234. }
  235. --- handle value 2 with (x == 0)<1>(2,) --->
  236. {
  237. stack: main{0<-1> :: (x == 0)<1>(2,) :: if ((x == 0))
  238. ...
  239. else
  240. ... <0> :: {
  241. ...
  242. }
  243. <0> :: while (true)
  244. ... <-1> :: return x;<-1>} :: top{}
  245. heap: fun<main>, 2,
  246. env: x: 2, main: fun<main>,
  247. }
  248. --- step exp 0 --->
  249. {
  250. stack: main{0<-1> :: (x == 0)<1>(2,) :: if ((x == 0))
  251. ...
  252. else
  253. ... <0> :: {
  254. ...
  255. }
  256. <0> :: while (true)
  257. ... <-1> :: return x;<-1>} :: top{}
  258. heap: fun<main>, 2,
  259. env: x: 2, main: fun<main>,
  260. }
  261. --- handle value 0 with (x == 0)<2>(2,0,) --->
  262. {
  263. stack: main{false<-1> :: if ((x == 0))
  264. ...
  265. else
  266. ... <0> :: {
  267. ...
  268. }
  269. <0> :: while (true)
  270. ... <-1> :: return x;<-1>} :: top{}
  271. heap: fun<main>, 2,
  272. env: x: 2, main: fun<main>,
  273. }
  274. --- handle value false with if ((x == 0))
  275. ...
  276. else
  277. ... <1>(false,) --->
  278. {
  279. stack: main{x = (x - 1);<-1> :: {
  280. ...
  281. }
  282. <0> :: while (true)
  283. ... <-1> :: return x;<-1>} :: top{}
  284. heap: fun<main>, 2,
  285. env: x: 2, main: fun<main>,
  286. }
  287. --- step stmt x = (x - 1); --->
  288. {
  289. stack: main{x<-1> :: x = (x - 1);<0> :: {
  290. ...
  291. }
  292. <0> :: while (true)
  293. ... <-1> :: return x;<-1>} :: top{}
  294. heap: fun<main>, 2,
  295. env: x: 2, main: fun<main>,
  296. }
  297. --- step lvalue x --->
  298. {
  299. stack: main{ptr<1><-1> :: x = (x - 1);<0> :: {
  300. ...
  301. }
  302. <0> :: while (true)
  303. ... <-1> :: return x;<-1>} :: top{}
  304. heap: fun<main>, 2,
  305. env: x: 2, main: fun<main>,
  306. }
  307. --- handle value ptr<1> with x = (x - 1);<1>(ptr<1>,) --->
  308. {
  309. stack: main{(x - 1)<-1> :: x = (x - 1);<1>(ptr<1>,) :: {
  310. ...
  311. }
  312. <0> :: while (true)
  313. ... <-1> :: return x;<-1>} :: top{}
  314. heap: fun<main>, 2,
  315. env: x: 2, main: fun<main>,
  316. }
  317. --- step exp (x - 1) --->
  318. {
  319. stack: main{x<-1> :: (x - 1)<0> :: x = (x - 1);<1>(ptr<1>,) :: {
  320. ...
  321. }
  322. <0> :: while (true)
  323. ... <-1> :: return x;<-1>} :: top{}
  324. heap: fun<main>, 2,
  325. env: x: 2, main: fun<main>,
  326. }
  327. --- step exp x --->
  328. {
  329. stack: main{2<-1> :: (x - 1)<0> :: x = (x - 1);<1>(ptr<1>,) :: {
  330. ...
  331. }
  332. <0> :: while (true)
  333. ... <-1> :: return x;<-1>} :: top{}
  334. heap: fun<main>, 2,
  335. env: x: 2, main: fun<main>,
  336. }
  337. --- handle value 2 with (x - 1)<1>(2,) --->
  338. {
  339. stack: main{1<-1> :: (x - 1)<1>(2,) :: x = (x - 1);<1>(ptr<1>,) :: {
  340. ...
  341. }
  342. <0> :: while (true)
  343. ... <-1> :: return x;<-1>} :: top{}
  344. heap: fun<main>, 2,
  345. env: x: 2, main: fun<main>,
  346. }
  347. --- step exp 1 --->
  348. {
  349. stack: main{1<-1> :: (x - 1)<1>(2,) :: x = (x - 1);<1>(ptr<1>,) :: {
  350. ...
  351. }
  352. <0> :: while (true)
  353. ... <-1> :: return x;<-1>} :: top{}
  354. heap: fun<main>, 2,
  355. env: x: 2, main: fun<main>,
  356. }
  357. --- handle value 1 with (x - 1)<2>(2,1,) --->
  358. {
  359. stack: main{1<-1> :: x = (x - 1);<1>(ptr<1>,) :: {
  360. ...
  361. }
  362. <0> :: while (true)
  363. ... <-1> :: return x;<-1>} :: top{}
  364. heap: fun<main>, 2,
  365. env: x: 2, main: fun<main>,
  366. }
  367. --- handle value 1 with x = (x - 1);<2>(ptr<1>,1,) --->
  368. {
  369. stack: main{{
  370. ...
  371. }
  372. <0> :: while (true)
  373. ... <-1> :: return x;<-1>} :: top{}
  374. heap: fun<main>, 1,
  375. env: x: 1, main: fun<main>,
  376. }
  377. --- step stmt {
  378. ...
  379. }
  380. --->
  381. {
  382. stack: main{while (true)
  383. ... <-1> :: return x;<-1>} :: top{}
  384. heap: fun<main>, 1,
  385. env: x: 1, main: fun<main>,
  386. }
  387. --- step stmt while (true)
  388. ... --->
  389. {
  390. stack: main{true<-1> :: while (true)
  391. ... <0> :: return x;<-1>} :: top{}
  392. heap: fun<main>, 1,
  393. env: x: 1, main: fun<main>,
  394. }
  395. --- step exp true --->
  396. {
  397. stack: main{true<-1> :: while (true)
  398. ... <0> :: return x;<-1>} :: top{}
  399. heap: fun<main>, 1,
  400. env: x: 1, main: fun<main>,
  401. }
  402. --- handle value true with while (true)
  403. ... <1>(true,) --->
  404. {
  405. stack: main{{
  406. ...
  407. }
  408. <-1> :: while (true)
  409. ... <-1> :: return x;<-1>} :: top{}
  410. heap: fun<main>, 1,
  411. env: x: 1, main: fun<main>,
  412. }
  413. --- step stmt {
  414. ...
  415. }
  416. --->
  417. {
  418. stack: main{if ((x == 0))
  419. ...
  420. else
  421. ... <-1> :: {
  422. ...
  423. }
  424. <0> :: while (true)
  425. ... <-1> :: return x;<-1>} :: top{}
  426. heap: fun<main>, 1,
  427. env: x: 1, main: fun<main>,
  428. }
  429. --- step stmt if ((x == 0))
  430. ...
  431. else
  432. ... --->
  433. {
  434. stack: main{if ((x == 0))
  435. ...
  436. else
  437. ... <-1> :: {
  438. ...
  439. }
  440. <0> :: while (true)
  441. ... <-1> :: return x;<-1>} :: top{}
  442. heap: fun<main>, 1,
  443. env: x: 1, main: fun<main>,
  444. }
  445. --- step stmt if ((x == 0))
  446. ...
  447. else
  448. ... --->
  449. {
  450. stack: main{(x == 0)<-1> :: if ((x == 0))
  451. ...
  452. else
  453. ... <0> :: {
  454. ...
  455. }
  456. <0> :: while (true)
  457. ... <-1> :: return x;<-1>} :: top{}
  458. heap: fun<main>, 1,
  459. env: x: 1, main: fun<main>,
  460. }
  461. --- step exp (x == 0) --->
  462. {
  463. stack: main{x<-1> :: (x == 0)<0> :: if ((x == 0))
  464. ...
  465. else
  466. ... <0> :: {
  467. ...
  468. }
  469. <0> :: while (true)
  470. ... <-1> :: return x;<-1>} :: top{}
  471. heap: fun<main>, 1,
  472. env: x: 1, main: fun<main>,
  473. }
  474. --- step exp x --->
  475. {
  476. stack: main{1<-1> :: (x == 0)<0> :: if ((x == 0))
  477. ...
  478. else
  479. ... <0> :: {
  480. ...
  481. }
  482. <0> :: while (true)
  483. ... <-1> :: return x;<-1>} :: top{}
  484. heap: fun<main>, 1,
  485. env: x: 1, main: fun<main>,
  486. }
  487. --- handle value 1 with (x == 0)<1>(1,) --->
  488. {
  489. stack: main{0<-1> :: (x == 0)<1>(1,) :: if ((x == 0))
  490. ...
  491. else
  492. ... <0> :: {
  493. ...
  494. }
  495. <0> :: while (true)
  496. ... <-1> :: return x;<-1>} :: top{}
  497. heap: fun<main>, 1,
  498. env: x: 1, main: fun<main>,
  499. }
  500. --- step exp 0 --->
  501. {
  502. stack: main{0<-1> :: (x == 0)<1>(1,) :: if ((x == 0))
  503. ...
  504. else
  505. ... <0> :: {
  506. ...
  507. }
  508. <0> :: while (true)
  509. ... <-1> :: return x;<-1>} :: top{}
  510. heap: fun<main>, 1,
  511. env: x: 1, main: fun<main>,
  512. }
  513. --- handle value 0 with (x == 0)<2>(1,0,) --->
  514. {
  515. stack: main{false<-1> :: if ((x == 0))
  516. ...
  517. else
  518. ... <0> :: {
  519. ...
  520. }
  521. <0> :: while (true)
  522. ... <-1> :: return x;<-1>} :: top{}
  523. heap: fun<main>, 1,
  524. env: x: 1, main: fun<main>,
  525. }
  526. --- handle value false with if ((x == 0))
  527. ...
  528. else
  529. ... <1>(false,) --->
  530. {
  531. stack: main{x = (x - 1);<-1> :: {
  532. ...
  533. }
  534. <0> :: while (true)
  535. ... <-1> :: return x;<-1>} :: top{}
  536. heap: fun<main>, 1,
  537. env: x: 1, main: fun<main>,
  538. }
  539. --- step stmt x = (x - 1); --->
  540. {
  541. stack: main{x<-1> :: x = (x - 1);<0> :: {
  542. ...
  543. }
  544. <0> :: while (true)
  545. ... <-1> :: return x;<-1>} :: top{}
  546. heap: fun<main>, 1,
  547. env: x: 1, main: fun<main>,
  548. }
  549. --- step lvalue x --->
  550. {
  551. stack: main{ptr<1><-1> :: x = (x - 1);<0> :: {
  552. ...
  553. }
  554. <0> :: while (true)
  555. ... <-1> :: return x;<-1>} :: top{}
  556. heap: fun<main>, 1,
  557. env: x: 1, main: fun<main>,
  558. }
  559. --- handle value ptr<1> with x = (x - 1);<1>(ptr<1>,) --->
  560. {
  561. stack: main{(x - 1)<-1> :: x = (x - 1);<1>(ptr<1>,) :: {
  562. ...
  563. }
  564. <0> :: while (true)
  565. ... <-1> :: return x;<-1>} :: top{}
  566. heap: fun<main>, 1,
  567. env: x: 1, main: fun<main>,
  568. }
  569. --- step exp (x - 1) --->
  570. {
  571. stack: main{x<-1> :: (x - 1)<0> :: x = (x - 1);<1>(ptr<1>,) :: {
  572. ...
  573. }
  574. <0> :: while (true)
  575. ... <-1> :: return x;<-1>} :: top{}
  576. heap: fun<main>, 1,
  577. env: x: 1, main: fun<main>,
  578. }
  579. --- step exp x --->
  580. {
  581. stack: main{1<-1> :: (x - 1)<0> :: x = (x - 1);<1>(ptr<1>,) :: {
  582. ...
  583. }
  584. <0> :: while (true)
  585. ... <-1> :: return x;<-1>} :: top{}
  586. heap: fun<main>, 1,
  587. env: x: 1, main: fun<main>,
  588. }
  589. --- handle value 1 with (x - 1)<1>(1,) --->
  590. {
  591. stack: main{1<-1> :: (x - 1)<1>(1,) :: x = (x - 1);<1>(ptr<1>,) :: {
  592. ...
  593. }
  594. <0> :: while (true)
  595. ... <-1> :: return x;<-1>} :: top{}
  596. heap: fun<main>, 1,
  597. env: x: 1, main: fun<main>,
  598. }
  599. --- step exp 1 --->
  600. {
  601. stack: main{1<-1> :: (x - 1)<1>(1,) :: x = (x - 1);<1>(ptr<1>,) :: {
  602. ...
  603. }
  604. <0> :: while (true)
  605. ... <-1> :: return x;<-1>} :: top{}
  606. heap: fun<main>, 1,
  607. env: x: 1, main: fun<main>,
  608. }
  609. --- handle value 1 with (x - 1)<2>(1,1,) --->
  610. {
  611. stack: main{0<-1> :: x = (x - 1);<1>(ptr<1>,) :: {
  612. ...
  613. }
  614. <0> :: while (true)
  615. ... <-1> :: return x;<-1>} :: top{}
  616. heap: fun<main>, 1,
  617. env: x: 1, main: fun<main>,
  618. }
  619. --- handle value 0 with x = (x - 1);<2>(ptr<1>,0,) --->
  620. {
  621. stack: main{{
  622. ...
  623. }
  624. <0> :: while (true)
  625. ... <-1> :: return x;<-1>} :: top{}
  626. heap: fun<main>, 0,
  627. env: x: 0, main: fun<main>,
  628. }
  629. --- step stmt {
  630. ...
  631. }
  632. --->
  633. {
  634. stack: main{while (true)
  635. ... <-1> :: return x;<-1>} :: top{}
  636. heap: fun<main>, 0,
  637. env: x: 0, main: fun<main>,
  638. }
  639. --- step stmt while (true)
  640. ... --->
  641. {
  642. stack: main{true<-1> :: while (true)
  643. ... <0> :: return x;<-1>} :: top{}
  644. heap: fun<main>, 0,
  645. env: x: 0, main: fun<main>,
  646. }
  647. --- step exp true --->
  648. {
  649. stack: main{true<-1> :: while (true)
  650. ... <0> :: return x;<-1>} :: top{}
  651. heap: fun<main>, 0,
  652. env: x: 0, main: fun<main>,
  653. }
  654. --- handle value true with while (true)
  655. ... <1>(true,) --->
  656. {
  657. stack: main{{
  658. ...
  659. }
  660. <-1> :: while (true)
  661. ... <-1> :: return x;<-1>} :: top{}
  662. heap: fun<main>, 0,
  663. env: x: 0, main: fun<main>,
  664. }
  665. --- step stmt {
  666. ...
  667. }
  668. --->
  669. {
  670. stack: main{if ((x == 0))
  671. ...
  672. else
  673. ... <-1> :: {
  674. ...
  675. }
  676. <0> :: while (true)
  677. ... <-1> :: return x;<-1>} :: top{}
  678. heap: fun<main>, 0,
  679. env: x: 0, main: fun<main>,
  680. }
  681. --- step stmt if ((x == 0))
  682. ...
  683. else
  684. ... --->
  685. {
  686. stack: main{if ((x == 0))
  687. ...
  688. else
  689. ... <-1> :: {
  690. ...
  691. }
  692. <0> :: while (true)
  693. ... <-1> :: return x;<-1>} :: top{}
  694. heap: fun<main>, 0,
  695. env: x: 0, main: fun<main>,
  696. }
  697. --- step stmt if ((x == 0))
  698. ...
  699. else
  700. ... --->
  701. {
  702. stack: main{(x == 0)<-1> :: if ((x == 0))
  703. ...
  704. else
  705. ... <0> :: {
  706. ...
  707. }
  708. <0> :: while (true)
  709. ... <-1> :: return x;<-1>} :: top{}
  710. heap: fun<main>, 0,
  711. env: x: 0, main: fun<main>,
  712. }
  713. --- step exp (x == 0) --->
  714. {
  715. stack: main{x<-1> :: (x == 0)<0> :: if ((x == 0))
  716. ...
  717. else
  718. ... <0> :: {
  719. ...
  720. }
  721. <0> :: while (true)
  722. ... <-1> :: return x;<-1>} :: top{}
  723. heap: fun<main>, 0,
  724. env: x: 0, main: fun<main>,
  725. }
  726. --- step exp x --->
  727. {
  728. stack: main{0<-1> :: (x == 0)<0> :: if ((x == 0))
  729. ...
  730. else
  731. ... <0> :: {
  732. ...
  733. }
  734. <0> :: while (true)
  735. ... <-1> :: return x;<-1>} :: top{}
  736. heap: fun<main>, 0,
  737. env: x: 0, main: fun<main>,
  738. }
  739. --- handle value 0 with (x == 0)<1>(0,) --->
  740. {
  741. stack: main{0<-1> :: (x == 0)<1>(0,) :: if ((x == 0))
  742. ...
  743. else
  744. ... <0> :: {
  745. ...
  746. }
  747. <0> :: while (true)
  748. ... <-1> :: return x;<-1>} :: top{}
  749. heap: fun<main>, 0,
  750. env: x: 0, main: fun<main>,
  751. }
  752. --- step exp 0 --->
  753. {
  754. stack: main{0<-1> :: (x == 0)<1>(0,) :: if ((x == 0))
  755. ...
  756. else
  757. ... <0> :: {
  758. ...
  759. }
  760. <0> :: while (true)
  761. ... <-1> :: return x;<-1>} :: top{}
  762. heap: fun<main>, 0,
  763. env: x: 0, main: fun<main>,
  764. }
  765. --- handle value 0 with (x == 0)<2>(0,0,) --->
  766. {
  767. stack: main{true<-1> :: if ((x == 0))
  768. ...
  769. else
  770. ... <0> :: {
  771. ...
  772. }
  773. <0> :: while (true)
  774. ... <-1> :: return x;<-1>} :: top{}
  775. heap: fun<main>, 0,
  776. env: x: 0, main: fun<main>,
  777. }
  778. --- handle value true with if ((x == 0))
  779. ...
  780. else
  781. ... <1>(true,) --->
  782. {
  783. stack: main{break;<-1> :: {
  784. ...
  785. }
  786. <0> :: while (true)
  787. ... <-1> :: return x;<-1>} :: top{}
  788. heap: fun<main>, 0,
  789. env: x: 0, main: fun<main>,
  790. }
  791. --- step stmt break; --->
  792. {
  793. stack: main{return x;<-1>} :: top{}
  794. heap: fun<main>, 0,
  795. env: x: 0, main: fun<main>,
  796. }
  797. --- step stmt return x; --->
  798. {
  799. stack: main{x<-1> :: return x;<0>} :: top{}
  800. heap: fun<main>, 0,
  801. env: x: 0, main: fun<main>,
  802. }
  803. --- step exp x --->
  804. {
  805. stack: main{0<-1> :: return x;<0>} :: top{}
  806. heap: fun<main>, 0,
  807. env: x: 0, main: fun<main>,
  808. }
  809. --- handle value 0 with return x;<1>(0,) --->
  810. {
  811. stack: top{0<-1>}
  812. heap: fun<main>, !!0,
  813. env: main: fun<main>,
  814. }
  815. result: 0