Skip to content

Register Machine Code Format

muserr edited this page Mar 17, 2020 · 4 revisions

<Here goes a description of the register machine code format, similar to Section 5.1.5 of SICP JS>

This section is still work in progress.

Treatment of register assignment:

1. Assigning a value from one register to another.

Assigning a value from register 'register-name-from' to 'register-name-to':

assign(register-name-to, reg(register-name-from))

For example, if you assign contents from register D to register C:

assign("C", reg("D"))

2. Assigning a value from one register to another.

Assigns a constant value to 'register-name'. Constant value is predefined.

assign(register-name, constant(constant-value))

During the treatment of a self-evaluating expression, we can also treat the expression as a constant value. Examples include:

Assignment of numeric values:

assign("A", constant(100))

Assignment of booleans:

assign("B", constant(true))
assign("C", constant(false))

Some noteworthy tips:

  • "register-name" seen in round brackets are just the actual register names in strings.

Clone this wiki locally