開発環境
- OS X Mavericks - Apple(OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Scheme (プログラミング言語)
- MIT/GNU Scheme (処理系)
計算機プログラムの構造と解釈(Gerald Jay Sussman(原著)、Julie Sussman(原著)、Harold Abelson(原著)、和田 英一(翻訳)、ピアソンエデュケーション、原書: Structure and Interpretation of Computer Programs (MIT Electrical Engineering and Computer Science)(SICP))の5(レジスタ計算機での計算)、5.4(積極制御評価器)、5.4.1(積極制御評価器の中核)、単純式の評価、手続き作用の評価、手続き作用、5.4.2(並びの評価と末尾再帰)、末尾再帰、5.4.3(条件式、代入および定義)、代入と定義、問題 5.24.を解いてみる。
その他参考書籍
問題 5.24.
追加箇所。
eval-dispatch (test (op self-evaluating?) (reg exp)) (branch (label ev-self-eval)) (test (op variable?) (reg exp)) (branch (label ev-variable)) (test (op quoted?) (reg exp)) (branch (label ev-quoted)) (test (op assignment?) (reg exp)) (branch (label ev-assignment)) (test (op definition?) (reg exp)) (branch (label ev-definition)) (test (op if?) (reg exp)) (branch (label ev-if)) (test (op lambda?) (reg exp)) (branch (label ev-lambda)) (test (op begin?) (reg exp)) (branch (label ev-begin)) (test (op cond?) (reg exp)) (branch (label ev-cond)) (test (op let?) (reg exp)) (branch (label ev-let)) (test (op application?) (reg exp)) (branch (label ev-application)) (goto (label unknown-expression-type)) ;; … ev-cond (assign unev (op cond-clauses) (reg exp)) (save continue) (goto (label ev-cond-loop)) ev-cond-loop (test (op null?) (reg unev)) (branch (label ev-cond-null)) (assign exp (op car) (reg unev)) (test (op cond-else-clause?) (reg exp)) (branch (label ev-cond-else)) (save exp) (assign exp (op cond-predicate) (reg exp)) (save unev) (save env) (assign continue (label ev-cond-decide)) (goto (label eval-dispatch)) ev-cond-null (restore continue) (assign val (const #f)) (goto (reg continue)) ev-cond-else (assign unev (op cond-actions) (reg exp)) (goto (label ev-sequence)) ev-cond-decide (restore env) (restore unev) (restore exp) (test (op true?) (reg val)) (branch (label ev-cond-consequent)) (assign unev (op cdr) (reg unev)) (goto (label ev-cond-loop)) ev-cond-consequent (assign unev (op cond-actions) (reg exp)) (goto (label ev-sequence))
まだ積極制御評価器の実装し終わってないから、実装したら入出力も試してみることに。
0 コメント:
コメントを投稿