Skip to content

Instantly share code, notes, and snippets.

@crcx
Created January 1, 2010 17:45
Show Gist options
  • Save crcx/267171 to your computer and use it in GitHub Desktop.
Save crcx/267171 to your computer and use it in GitHub Desktop.
Notes on stack comments in Retro

Reading Stack Comments

Stack comments in Retro are a compact form, using short codes in place of actual words. These codes are listed in the next section.

A typical comment for a word that takes two arguments and leaves one will look like:

( xy-z )

In a few cases, words may consume or leave a variable number of arguments. In this case, we denote it like:

( n-n || n- )

There are two other modifiers in use. Some words have different compile-time and run-time stack use. We prefix the comment with C: for compile-time, and R: for run-time actions.

If not specified, the stack comments are for runtime effects. Words with no C: are assumed to have no stack impact during compilation.

Codes used in the stack comments:

x, y, z, n Generic numbers
q, r Quotient, Remainder (for division)
" Word parses for a string
a Address
c ASCII character
$ Zero-terminated string
f Flag
... Variable number of values on stack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment