Advertisement
Guest User

Untitled

a guest
Jan 11th, 2014
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. (def test-block
  2. '((:constant :c 10)
  3. (:div :d :i :c)
  4. (:mod :r :i :c)
  5. (:store :p1 :d)
  6. (:store :p2 :r)
  7. (:add :x :y :z)
  8. (:jmp :next-block)))
  9.  
  10. (defn test-matcher
  11. [block typemap]
  12. (run* [q]
  13. (conde
  14. [(fresh [?types ?idiv ?imod ?a ?b ?c ?d]
  15. (membero ?idiv block)
  16. (membero ?imod block)
  17. (== ?idiv `(:div ~?a ~?c ~?d))
  18. (== ?imod `(:mod ~?b ~?c ~?d))
  19. (== q `((~?idiv ~?imod)
  20. ((:divmod32 ~?a ~?b ~?c ~?d)))))]
  21. [(fresh [?types ?idiv ?a ?b ?c]
  22. (membero ?idiv block)
  23. (== ?idiv `(:div ~?a ~?b ~?c))
  24. (== q `(((~?idiv))
  25. ((:div32 ~?a ~?b ~?c)))))]
  26. )))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement