3imp 読んでみる (15)

primitive なソレは return キメ打ちで OK との事で試験を書いてみた。

(test-section "primitive procedure")
(test* "(VM '() (compile '(= 1 1) '(halt)) (init-env) '() '())"
       #t
       (VM '() (compile '(= 1 1) '(halt)) (init-env) '() '()))
(test* "(VM '() (compile '(= 1 2) '(halt)) (init-env) '() '())"
       #f
       (VM '() (compile '(= 1 2) '(halt)) (init-env) '() '()))
(test* "(VM '() (compile '(car '(1 2)) '(halt)) (init-env) '() '())"
       1
       (VM '() (compile '(car '(1 2)) '(halt)) (init-env) '() '()))
(test* "(VM '() (compile '(cdr '(1 2)) '(halt)) (init-env) '() '())"
       '(2)
       (VM '() (compile '(cdr '(1 2)) '(halt)) (init-env) '() '()))

全部パス。試験してない他のインストラクションをナニして次の lexical address と思われるソレをヤッツケて stack based 方面に去りたい今日この頃ッス。