[Bug fixes; added pl-call and put_atom instructions. Gergö Barany **20090125212414] { hunk ./wam.fs 127 + integer-tag of + integer-value 0 .r + endof hunk ./wam.fs 586 +: wam-ternary-instr-epilogue + POSTPONE else + POSTPONE drop + POSTPONE drop + POSTPONE drop + POSTPONE endif + ; immediate compile-only + hunk ./wam.fs 609 +: ;ternary-wam-instr + POSTPONE wam-ternary-instr-epilogue + POSTPONE ; + ; immediate compile-only + hunk ./wam.fs 615 -wam-instr: pl-execute ( flag xt -- ) +defer try-alternatives + +wam-instr: pl-execute ( flag xt -- flag ) hunk ./wam.fs 625 + dup try-alternatives + ;unary-wam-instr + +wam-instr: pl-call ( xt -- ) + \ The new "tail call flag" is 0, because this is *not* a tail call. + 0 swap + \ Call the goal. + execute + \ Drop the flag. + drop + \ Backtrack if necessary. + dup try-alternatives + ;unary-wam-instr + +:noname ( flag -- ) hunk ./wam.fs 647 - alternative recurse + ( flag ) + 0= if + alternative pl-call + else + alternative pl-execute + endif hunk ./wam.fs 657 - ;unary-wam-instr + ; is try-alternatives hunk ./wam.fs 675 - ." ;" cr hunk ./wam.fs 681 + ." ;" cr hunk ./wam.fs 694 -wam-instr: put_const ( n ai -- ) +wam-instr: put_constant ( n ai -- ) hunk ./wam.fs 700 +wam-instr: put_atom ( addr u ai -- ) + \ make new atom from string, put in register ai + { ai } + create-atom ai ! + ;ternary-wam-instr + hunk ./wam.fs 834 + \ ." global-s @ @ = " global-s @ @ unparse cr hunk ./wam.fs 843 - global-s @ @ vn @ unify - vn dereference vn ! + global-s @ @ vn @ + unify + vn @ dereference vn ! hunk ./wam.fs 986 -: y1 global-state cp-e 0 cells + ; -: y2 global-state cp-e 1 cells + ; -: y3 global-state cp-e 2 cells + ; -: y4 global-state cp-e 3 cells + ; -: y5 global-state cp-e 4 cells + ; -: y6 global-state cp-e 5 cells + ; -: y7 global-state cp-e 6 cells + ; -: y8 global-state cp-e 7 cells + ; -: y9 global-state cp-e 8 cells + ; -: y10 global-state cp-e 9 cells + ; -: y11 global-state cp-e 10 cells + ; -: y12 global-state cp-e 11 cells + ; -: y13 global-state cp-e 12 cells + ; -: y14 global-state cp-e 13 cells + ; -: y15 global-state cp-e 14 cells + ; -: y16 global-state cp-e 15 cells + ; -: y17 global-state cp-e 16 cells + ; -: y18 global-state cp-e 17 cells + ; -: y19 global-state cp-e 18 cells + ; -: y20 global-state cp-e 19 cells + ; -: y21 global-state cp-e 20 cells + ; -: y22 global-state cp-e 21 cells + ; -: y23 global-state cp-e 22 cells + ; -: y24 global-state cp-e 23 cells + ; -: y25 global-state cp-e 24 cells + ; -: y26 global-state cp-e 25 cells + ; -: y27 global-state cp-e 26 cells + ; -: y28 global-state cp-e 27 cells + ; -: y29 global-state cp-e 28 cells + ; -: y30 global-state cp-e 29 cells + ; -: y31 global-state cp-e 30 cells + ; -: y32 global-state cp-e 31 cells + ; -: y33 global-state cp-e 32 cells + ; -: y34 global-state cp-e 33 cells + ; -: y35 global-state cp-e 34 cells + ; -: y36 global-state cp-e 35 cells + ; -: y37 global-state cp-e 36 cells + ; -: y38 global-state cp-e 37 cells + ; -: y39 global-state cp-e 38 cells + ; -: y40 global-state cp-e 39 cells + ; -: y41 global-state cp-e 40 cells + ; -: y42 global-state cp-e 41 cells + ; +: y1 global-state cp-e @ 0 cells + ; +: y2 global-state cp-e @ 1 cells + ; +: y3 global-state cp-e @ 2 cells + ; +: y4 global-state cp-e @ 3 cells + ; +: y5 global-state cp-e @ 4 cells + ; +: y6 global-state cp-e @ 5 cells + ; +: y7 global-state cp-e @ 6 cells + ; +: y8 global-state cp-e @ 7 cells + ; +: y9 global-state cp-e @ 8 cells + ; +: y10 global-state cp-e @ 9 cells + ; +: y11 global-state cp-e @ 10 cells + ; +: y12 global-state cp-e @ 11 cells + ; +: y13 global-state cp-e @ 12 cells + ; +: y14 global-state cp-e @ 13 cells + ; +: y15 global-state cp-e @ 14 cells + ; +: y16 global-state cp-e @ 15 cells + ; +: y17 global-state cp-e @ 16 cells + ; +: y18 global-state cp-e @ 17 cells + ; +: y19 global-state cp-e @ 18 cells + ; +: y20 global-state cp-e @ 19 cells + ; +: y21 global-state cp-e @ 20 cells + ; +: y22 global-state cp-e @ 21 cells + ; +: y23 global-state cp-e @ 22 cells + ; +: y24 global-state cp-e @ 23 cells + ; +: y25 global-state cp-e @ 24 cells + ; +: y26 global-state cp-e @ 25 cells + ; +: y27 global-state cp-e @ 26 cells + ; +: y28 global-state cp-e @ 27 cells + ; +: y29 global-state cp-e @ 28 cells + ; +: y30 global-state cp-e @ 29 cells + ; +: y31 global-state cp-e @ 30 cells + ; +: y32 global-state cp-e @ 31 cells + ; +: y33 global-state cp-e @ 32 cells + ; +: y34 global-state cp-e @ 33 cells + ; +: y35 global-state cp-e @ 34 cells + ; +: y36 global-state cp-e @ 35 cells + ; +: y37 global-state cp-e @ 36 cells + ; +: y38 global-state cp-e @ 37 cells + ; +: y39 global-state cp-e @ 38 cells + ; +: y40 global-state cp-e @ 39 cells + ; +: y41 global-state cp-e @ 40 cells + ; +: y42 global-state cp-e @ 41 cells + ; hunk ./wam.fs 1093 + \ Be optimistic :-) + -1 prolog-success ! hunk ./wam.fs 1101 - ." No :-(" cr + ." No (further) solutions" cr hunk ./wam.fs 1222 - -1 prolog-success ! hunk ./wam.fs 1223 - -1 prolog-success ! hunk ./wam.fs 1224 - -1 prolog-success ! hunk ./wam.fs 1225 - -1 prolog-success ! hunk ./wam.fs 1400 + \ ." compare_terms(" + \ a1 @ unparse ." , " + \ a2 @ unparse ." , " + \ a3 @ unparse ." )" cr }