13 call 14 call 15 call

Info icon This preview shows pages 3–5. Sign up to view the full content.

View Full Document Right Arrow Icon
(13) Call: move(2,right,center,left) ? (14) Call: move(1,right,left,center) ? (15) Call: move(0,right,center,left) ? (15) Exit: move(0,right,center,left) ? (16) Call: display([right,left]) ? [right,left] (16) Exit: display([right,left]) ? (17) Call: move(0,center,left,right) ? (17) Exit: move(0,center,left,right) ? (14) Exit: move(1,right,left,center) ? (18) Call: display([right,center]) ? [right,center] (18) Exit: display([right,center]) ? (19) Call: move(1,left,center,right) ? (20) Call: move(0,left,right,center) ? (20) Exit: move(0,left,right,center) ? (21) Call: display([left,center]) ? [left,center] (21) Exit: display([left,center]) ? (22) Call: move(0,right,center,left) ? (22) Exit: move(0,right,center,left) ? (19) Exit: move(1,left,center,right) ? (13) Exit: move(2,right,center,left) ? (1) Exit: move(3,left,center,right) ? (0) Exit: hanoi(3) ? yes [trace] | ?- [ load module push_io ] End XSB (cputime 0.03 secs, elapsetime 37.74 secs) vulcan6% exit Script done on Sat 11 Mar 2006 10:08:33 AM CST
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6. Consider the denotational semantics below: S [[ S 1 ; S 2 ]] store = S [[ S 2 ]] ( S [[ S 1 ]] store ) S [[ V := E ]] store = store [ E [[ E ]] store / V ] S [[ while C loop S end loop ]] store = if C [[ C ]] store then S [[ while C loop S end loop ]] ( S [[ S ]] store ) else store C [[ E 1 > E 2 ]] store = if E [[ E 1 ]] store > E [[ E 2 ]] store then true else false E [[ E 1 + E 2 ]] store = E [[ E 1 ]] store + E [[ E 2 ]] store E [[ E 1 E 2 ]] store = E [[ E 1 ]] store E [[ E 2 ]] store E [[ I ]] store = N [[ I ]] E [[ V ]] store = if store [[ V ]] = then else store [[ V ]] Assume that N returns the integer value of its argument. Given the initial store ( λ V . ) [1/u] [5/y] [5/z], compute the store which results from evaluating S on the program below, showing all steps used in the evaluation. while (u > 0) loop u := u - 1; z := z + y end loop Let store 0 = ( λ V . ) [1/u] [5/y] [5/z]. The steps of execution using the denotational semantics are: (a) S [[ while u > 0 loop u := u 1 ; z := z + y end loop ]] store 0 (b) if C [[ u > 0 ]] store 0 then S [[ while u > 0 loop u := u 1 ; z := z + y end loop ]] ( S [[ u := u 1 ; z := z + y ]] store 0 ) else store 0 The following steps elaborate C [[ u > 0 ]] store 0 .
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern