Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
SECD machine
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
SECD machine
(section)
Add topic