Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
SECD machine
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Instructions== * '''<code>nil</code>''' pushes a nil pointer onto the stack * '''<code>ldc</code>''' pushes a constant argument onto the stack * '''<code>ld</code>''' 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 <code>(1 . 3)</code> gives the current function's (level 1) third parameter. * '''<code>sel</code>''' 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 '''<code>C</code>''', a pointer to the instruction following '''<math>sel</math>''' is saved on the dump. * '''<code>join</code>''' pops a list reference from the dump and makes this the new value of '''<code>C</code>'''. This instruction occurs at the end of both alternatives of a '''<code>sel</code>'''. * '''<code>ldf</code>''' 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. * '''<code>ap</code>''' 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 '''<code>C</code>''' to the closure's function pointer. The previous values of '''<code>S</code>''', '''<code>E</code>''', and the next value of '''<code>C</code>''' are saved on the dump. * '''<code>ret</code>''' pops one return value from the stack, restores '''<code>S</code>''', '''<code>E</code>''', and '''<code>C</code>''' from the dump, and pushes the return value onto the now-current stack. * '''<code>dum</code>''' pushes a "dummy", an empty list, in front of the environment list. * '''<code>rap</code>''' works like '''<math>ap</math>''', 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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)