灯下 登录
计算机科学 / SICP / subsection 中英对照

5.1.5 Instruction Summary

A controller instruction in our register-machine language has one of the

following forms, where each ⟨

我们的寄存器机器语言中,控制器指令具有以下形式之一,其中每个 ⟨

i
n
p
u

t
i

⟩ is either

(reg ⟨register-name⟩) or (const ⟨constant-value⟩).

These instructions were introduced in 5.1.1:

⟩ 是 (reg ⟨register-name⟩) 或 (const ⟨constant-value⟩) 之一。以下指令在 5.1.1 节中已作介绍:

The use of registers to hold labels was introduced in 5.1.3:

用寄存器保存标号的用法在 5.1.3 节中已作介绍:

Instructions to use the stack were introduced in 5.1.4:

使用栈的指令在 5.1.4 节中已作介绍:

The only kind of ⟨constant-value⟩ we have seen so far is a number,

but later we will use strings, symbols, and lists.

For example,

目前为止我们见到的 ⟨constant-value⟩ 只有数,但后续还将用到字符串、符号和表。例如:

(const "abc") is the string "abc",

(const "abc") 是字符串 "abc",

(const abc) is the symbol abc,

(const abc) 是符号 abc,

(const (a b c)) is the list (a b c),

(const (a b c)) 是表 (a b c),

and (const ()) is the empty list.

(const ()) 是空表。

Racket #lang sicp
(assign ⟨register-name⟩ (reg ⟨register-name⟩))
(assign ⟨register-name⟩
 (const ⟨constant-value⟩))
(assign ⟨register-name⟩
 (op ⟨operation-name⟩)
 ⟨input₁⟩ … ⟨inputₙ⟩)
(perform (op ⟨operation-name⟩)
 ⟨input₁⟩
 …
 ⟨inputₙ⟩)
(test (op ⟨operation-name⟩)
 ⟨input₁⟩
 …
 ⟨inputₙ⟩)
(branch (label ⟨label-name⟩))
(goto (label ⟨label-name⟩))
Racket #lang sicp
(assign ⟨register-name⟩ (label ⟨label-name⟩))
(goto (reg ⟨register-name⟩))
Racket #lang sicp
(save ⟨register-name⟩)
(restore ⟨register-name⟩)