($help) .dup .where (.pop .pop) (100 .dict .def) .ifelse .cvx .exec

(/def)
(3 .copy .exch .pop .def .pop $help 3 1 .roll .put) .cvx .def

(/xdef)
(3 .copy .exch .pop .cvx .def .pop $help 3 1 .roll .put) .cvx .def

(
/def)
("/def" accepts three entries on the stack: a key, string, and value.
the string is stored under the key in the $help dictionary, and
the value is stored as a noun under the key in the current dictionary.)
(/def) .load /def

(
/xdef)
("/xdef" accepts three entries on the stack: a key, string, and value.
the string is stored under the key in the $help dictionary, and
the value is stored as a verb under the key in the current dictionary.)
(/xdef) .load /xdef

(
=)
("="
prints the top of the stack on the default display)
(( ) .cvis .print (
).print)/xdef
(
?)
("?"
prints the explanation of the given key from the $help dictionary)
($help .exch .get =)/xdef

(
??)
("??"
prints the names of all the utility commands found in the $help
dictionary.)
($help /kdir)/xdef

(!tc!)
0 .def

(
/pause)
(/pause is used to pause the execution of a program until the user types somthing.)
((
** type CR to continue)= .mystream .readitem .pop .pop)/xdef

(
/stk)
("/stk"
prints (without distroying) the contents of the operand stack.)
(.cntstk .dup 1 .add .copy (.dup .type .print
(
).print = ) .cvx .rept .pop)/xdef

(
/pstk)
("/pstk"
pretty prints (without distroying) the contents of the operand stack.)
(.cntstk .dup 1 .add .copy (==) .cvx .rept .pop)/xdef

(
/dir)
("/dir"
prints the contents of the dictionary on top of the operand stack.)
((.exch ( ) .cvis .print (
).print .dup .type .print ().print =) .cvx .dictforall)/xdef

(
/kdir)
("/kdir" prints the keys found in the dictionary on the top of the operand
stack.)
((.exch = .pop) .cvx .dictforall)/xdef


(
/clr)
("/clr"
clears the operand stack (same as .clrstk))
(.clrstk) /xdef

(
/if)
("/if" is equivalent to ".cvx .if")
(.cvx .if)/xdef

(
/ifelse)
("/ifelse" is equivalent to " .ifelse .cvx .exec")
(.ifelse .cvx .exec)/xdef

(
[)
("[" is a command that marks the operand stack for use by the command "]".
This pair of commands is use to create arrays. For example:
[ 1 2 (hello) ]
will create an array containing two integers (1 and 2) and the string
"hello".)
(.mark)/xdef

(
])
("]" is a command that counts the elements after the mark on the stack and
puts these elements into an array which is left on the stack.
The pair of commands ( "[" and "]" ) is use to create arrays. For example:
[ 1 2 (hello) ]
will create an array containing two integers (1 and 2) and the string
"hello".)
(.cnttomrk .array .astore .exch .pop)/xdef

(
/cdict)
(/cdict builds a dictionary with the given length if one already does not exist)
((!dctcnt) .exch .def .dup .where ( 2 .copy .exch .get .itype 8 .eq .not (.pop !dctcnt .dict .def)(.pop .pop)/ifelse) (!dctcnt .dict .def) /ifelse)/xdef


(
==)
(== is used to print all types of objects in a manner which can easily be
read. The object to be printed is expected on the operand stack.
<x> == => -- )
((!tab!) -1 .def pprint )/xdef

(pprint)
(pprint supports == and does all the printing)
(.dup .type $ptypes .exch .get .exec)/xdef


(/buildcommands)
(/buildcommands updates the inverted $commands dictionary)
(($commands) .sysdict .maxlength /cdict
$commands .begin
.sysdict (.dup .itype 7 .eq (.exch .def)(.pop .pop) /ifelse).cvx .dictforall
.end)/xdef

($ptypes) 15 /cdict

$ptypes .begin
(.nulltype)((nulltype -- no value)=).cvx .def
(.integertype)((integertype -- value is: ) .print =).cvx .def
(.longintegertype)((longintegertype -- value is: ) .print =).cvx .def
(.realtype)((realtype -- value is: ) .print =).cvx .def
(.booleantype)((booleantype -- value is: ) .print =).cvx .def
(.stringtype)((stringtype -- value is: ) .print =).cvx .def
(.streamtype)((streamtype -- no value)=).cvx .def
(.commandtype)((commandtype -- value is: ) .print $commands .exch .get =).cvx .def
(.dicttype)((dicttype -- length is: ).print .dup .length ( ).cvis .print ( maxlength is: ).print .maxlength =).cvx .def
(.arraytype)(tabinc tabprint(array: )= (tabprint
pprint).cvx .arrayforall tabdec).cvx .def
(.pointertype)((pointertype -- from the symbol: ) .print .derefptrkey =).cvx .def
(.stacktype)((stacktype -- no value)=).cvx .def
(.frametype)((frametype -- no value)=).cvx .def
(.marktype)((marktype -- no value)=).cvx .def
.end

(tabinc)((!tab!) .dup .load 1 .add .store).cvx .def
(tabprint)(!tab! ((
).print).cvx .rept).cvx .def
(tabdec)((!tab!) .dup .load 1 .sub .store).cvx .def