# Syntax RETRO code consists of a series of whitespace delimited tokens. Each of these can have an optional prefix telling RETRO how to treat the token. If the token lacks a valid prefix, it will be treated as a word name. So: [prefix][token] Prefixes are single character modifiers. They are similar to colors in ColorForth, but are handled via words in the `prefix:` namespace. The major prefixes are: @ Fetch from variable ! Store into variable & Pointer to named item # Numbers $ ASCII characters ' Strings ( Comments : Define a word Example: ~~~ (This_is_a_comment) ~~~ Define some words: ~~~ :hello (-) 'Hello_World! s:put nl ; :n:square (n-m) dup * ; ~~~ And then use them: ~~~ hello #33 n:square ~~~ Numbers must be prefixed with a # for RETRO to recognize them: ~~~ #2 n:put sp #3 n:put sp #4 n:put sp nl ~~~ A few more things... ~~~ $a (this_is_the_ASCII_'a') ~~~ Strings: ~~~ 'Use_underscores_in_place_of_spaces_in_strings s:put nl ~~~ Strings also allow for formatted output: ~~~ #3 #1 #2 '%n_+_%n_=_%n\n s:format s:put ~~~ Variables: ~~~ 'Foo var #100 !Foo @Foo n:put ~~~ Note that RETRO will only run code in a fenced block (starting and ending with ~~~). This allows for code and documentation to be intermixed easily. The full glossary can be browsed: http://forthworks.com:9999 or gopher://forthworks.com:9999
Eval
New
Save
Load
Clear
Go