User Tools

Site Tools


sd:star_forth_dictionary

This is an old revision of the document!


Star Forth Dictionary

Also see: Star Forth Test Suite

Here is a list of each word that comes standard in Star Forth. Included is a short definition as to its general usage.

+ (add)

This adds the two numbers on the top of the stack and pushes the result.

  1 2 + .

This puts a 1 and a 2 on the stack, then adds them and pushes the result. Then, the . (dot) command prints the result, which is 3:

  3 ok

BYE

This quits the REPL (the Forth environment).

Usage:

  BYE

. (dot)

This is the “print” command. It prints whatever is on the TOS. For example:

  5 .             ( this prints 5. )
  1 1 + .         ( this prints 2. )

DUP

This command duplicates the top item on the stack. So if your stack is:

  1 2 3

then DUP will make it:

  1 2 3 3

.N (dotn)

This is the print command, like . (dot) but it does not print a space after numbers.


More coming soon!

sd/star_forth_dictionary.1776146946.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki