Instructions
- nil pushes a nil pointer onto the stack
- ldc pushes a constant argument onto the stack
- ld pushes the value of a variable onto the stack. The variable is indicated by the argument, a pair. The pair's car specifies the level, the cdr the position. So "(1 . 3)" gives the current function's (level 1) third parameter.
- sel expects two list arguments, and pops a value from the stack. The first list is executed if the popped value was non-nil, the second list otherwise. Before one of these list pointers is made the new C, a pointer to the instruction following sel is saved on the dump.
- join pops a list reference from the dump and makes this the new value of C. This instruction occurs at the end of both alternatives of a sel.
- ldf takes one list argument representing a function. It constructs a closure (a pair containing the function and the current environment) and pushes that onto the stack.
- ap pops a closure and a list of parameter values from the stack. The closure is applied to the parameters by installing its environment as the current one, pushing the parameter list in front of that, clearing the stack, and setting C to the closure's function pointer. The previous values of S, E, and the next value of C are saved on the dump.
- ret pops one return value from the stack, restores S, E, and C from the dump, and pushes the return value onto the now-current stack.
- dum pushes a "dummy", an empty list, in front of the environment list.
- rap works like ap, only that it replaces an occurrence of a dummy environment with the current one, thus making recursive functions possible
A number of additional instructions for basic functions like car, cdr, list construction, integer addition, I/O, etc. exist. They all take any necessary parameters from the stack.
Read more about this topic: SECD Machine
Famous quotes containing the word instructions:
“They had supposed their formula was fixed.
They had obeyed instructions to devise
A type of cold, a type of hooded gaze.
But when the Negroes came they were perplexed.
These Negroes looked like men....”
—Gwendolyn Brooks (b. 1917)
“If we consider what happens in conversation, in reveries, in remorse, in times of passion, in surprises, in the instructions of dreams, wherein often we see ourselves in masquerade,the droll disguises only magnifying and enhancing a real element, and forcing it on our distinct notice,we shall catch many hints that will broaden and lighten into knowledge of the secret of nature.”
—Ralph Waldo Emerson (18031882)
“Realizing that his time was nearly spent, he gave full oral instructions about his burial and the manner in which he wished to be remembered.... A few minutes later, feeling very tired, he left the room, remarking, I have no disposition to leave this precious circle. I love to be here surrounded by my family and friends. Then he gave them his blessing and said, I am ready to go and I wish you goodnight.”
—For the State of New Hampshire, U.S. public relief program (1935-1943)