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!
==Informal description== When evaluation of an expression begins, the expression is loaded as the only element of control '''<code>C</code>'''. The environment '''<code>E</code>''', stack '''<code>S</code>''' and dump '''<code>D</code>''' begin empty. During evaluation of '''<code>C</code>''' it is converted to [[reverse Polish notation]] (RPN) with <code>ap</code> (for [[apply]]) being the only operator. For example, the expression <code>F (G X)</code> (a single list element) is changed to the list <code>X:G:ap:F:ap</code>. Evaluation of '''<code>C</code>''' proceeds similarly to other RPN expressions. If the first item in '''<code>C</code>''' is a value, it is pushed onto the stack '''<code>S</code>'''. More exactly, if the item is an identifier, the value pushed onto the stack will be the binding for that identifier in the current environment '''<code>E</code>'''. If the item is an abstraction, a [[closure (computer science)|closure]] is constructed to preserve the bindings of its free variables (which are in '''<code>E</code>'''), and it is this closure which is pushed onto the stack. If the item is '''<code>ap</code>''', two values are popped off the stack and the application done (first applied to second). If the result of the application is a value, it is pushed onto the stack. If the application is of an abstraction to a value, however, it will result in a lambda calculus expression that may itself be an application (rather than a value), and so cannot be pushed onto the stack. In this case, the current contents of '''<code>S</code>''', '''<code>E</code>''', and '''<code>C</code>''' are pushed onto the dump '''<code>D</code>''' (which is a stack of these triples), '''<code>S</code>''' is reinitialized to empty, and '''<code>C</code>''' is reinitialized to the application result with '''<code>E</code>''' containing the environment for the free variables of this expression, augmented with the binding that resulted from the application. Evaluation then proceeds as above. Completed evaluation is indicated by '''<code>C</code>''' being empty, in which case the result will be on the stack '''<code>S</code>'''. The last saved evaluation state on '''<code>D</code>''' is then popped, and the result of the completed evaluation is pushed onto the stack contents restored from '''<code>D</code>'''. Evaluation of the restored state then continues as above. If '''<code>C</code>''' and '''<code>D</code>''' are both empty, overall evaluation has completed with the result on the stack '''<code>S</code>'''.
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