A controller instruction in our register-machine language has one of the following forms, where each $input$$_i$ is either (reg register-name) reg($register$-$name$) or (const constant-value). constant($constant$-$value$).
These instructions were introduced in section 5.1.1:
Original | JavaScript |
(assign $register-name$ (reg $register-name$)) (assign $register-name$ (const $constant-value$)) (assign $register-name$ (op $operation-name$) $input_{1}$ $\ldots$ $input_{n}$) (perform (op $operation-name$) $input_{1}$ $\ldots$ $input_{n}$) (test (op $operation-name$) $input_{1}$ $\ldots$ $input_{n}$) (branch (label $label-name$)) (goto (label $label-name$)) | assign($register$-$name$, reg($register$-$name$)) assign($register$-$name$, constant($constant$-$value$)) assign($register$-$name$, list(op($operation$-$name$), $input$$_1$, $\ldots$, $input$$_n$)) perform(list(op($operation$-$name$), $input$$_1$, $\ldots$, $input$$_n$)) test(list(op($operation$-$name$), $input$$_1$, $\ldots$, $input$$_n$)) branch(label($label$-$name$)) go_to(label($label$-$name$)) |
The use of registers to hold labels was introduced in section 5.1.3:
Original | JavaScript |
(assign $register-name$ (label $label-name$)) (goto (reg $register-name$)) | assign($register$-$name$, label($label$-$name$)) go_to(reg($register$-$name$)) |
Instructions to use the stack were introduced in section 5.1.4:
Original | JavaScript |
(save $register-name$) (restore $register-name$) | save($register$-$name$) restore($register$-$name$) |
The only kind of $\langle constant-value \rangle$ $constant$-$value$ we have seen so far is a number, but later we will use strings, symbols, also use strings and lists.
Original | JavaScript | |
For example, (const "abc") is the string "abc", (const abc) is the symbol abc, (const (a b c)) is the list (a b c), and (const ()) is the empty list. | For example, constant("abc") is the string "abc", constant(null) is the empty list, and constant(list("a", "b", "c")) is the list list("a", "b", "c"). |