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
Stack-oriented programming
(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!
== Stack effect diagrams == As an aid to understanding the effect of the statement, a short comment is used showing the top of the stack before and after the statement. The top of the stack is rightmost if there are multiple items. This notation is commonly used in the Forth language, where comments are enclosed in parentheses. <syntaxhighlight lang="forth">( before -- after )</syntaxhighlight> For example, the basic Forth stack operators are described: <syntaxhighlight lang="forth"> dup ( a -- a a ) drop ( a -- ) swap ( a b -- b a ) over ( a b -- a b a ) rot ( a b c -- b c a ) </syntaxhighlight> The <code>fib</code> function below is described: <syntaxhighlight lang="forth">fib ( n -- n' )</syntaxhighlight> It is equivalent to [[precondition]]s and [[postcondition]]s in [[Hoare logic]]. Both comments may also be referenced as [[assertion (computing)|assertions]], though not necessarily in the context of Stack-based languages.
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)