Arithmetic Commands

.add
: <n><m> .add => <n+m>
.sub
: <n><m> .sub => <n-m>
.mul
: <n><m> .mul => <n*m>
.div
: <n><m> .div => <n/m>

Boolean and Relational Commands

.true
: .true => <.true>
.false
: .false => <.false>
.eq
: <n><m> .eq => <.true> if n = m
<.false> if n # m
.gt
: <n><m> .gt => <.true> if n > m
<.false> if n <= m
.lt
: <n><m> .lt => <.true> if n < m
<.false> if n >= m
.not
: <b> .not => <~b>

Stack Manipulation Commands

.pop
: <x> .pop => --
.copy
: <x1><x2> ... <xi><i> .copy => <x1><x2> ... <xi><x1><x2> ... <xi>
.cntstk
: | <x1><x2> ... <xi> .cntstk => <i>
.roll
: <x1><x2> ... <xi><i><j> .roll => <x(j+1) mod i> ... <xi><x1>...<xj mod i>
.dup
: <x> .dup => <x><x>
.clrstk
: | <x1><x2> ... <xi> .clrstk => |
.exch
: <x><y> .exch => <y><x>

Dictionary Related Commands

.dict
: <i> .dict => <d> (dictionary with capacity of i entries)
.def
: <k><v> .def => -- (associates the value v with the key k in the current dictionary)
.del
: <d><k> .del => -- (deletes the key k from the dictionary d)
.load
: <k> .load => <v> (loads the value associated with k in the current dictionary)
.store
: <k><v> .store => -- (finds a definition of k in the current context and replaces that
definition with value v. If no definition of k exists then the
definition is placed in the current dictionary.)
.put
: <d><k><v> .put => -- (associates value v with key k in dictionary d.)
.get
: <d><k> .get => <v> (retrieves the value associated with k in dictionary d.)
.known
: <d><k> .known => <.true> if key k is in dictionary d.
<.false> if key k is not in dictionary d.
.where
: <k> .where => <.true><d> if k is found in some dictionary d.
<.false> if k is not found in any dictionary.
.clrdict
: <d> .clrdict => -- (clears all entries from dictionary d.)
.dictforall: <d><x>.dictforall => -- (puts <k><v> on the stack, and then executes <x>. This is done
for every k,v pair in dictionary d)
.begin
: <d> .begin => -- (makes d the current dictionary on the dictionary stack.)
.end
: .end => -- (pops the current dictionary from the dictionary stack.)
.sysdict
: .sysdict => <systemdictionary>

Execution Control Commands

.exec
: <x> .exec => -- (executes object x)
.if
: <b><x> .if => -- (if b = .true then execute x)
.ifelse
: <b><x><y> .ifelse => -- (if b = .true then execute x else execute y)
.rept
: <i><x> .rept => -- (execute x -- i times)
.loop
: <x> .loop => -- (execute x until a .exit command is executed)
.exit
: .exit => -- (exit from the current .rept, .loop, .dictforall, .arrayforall commands)
.stop
: .stop => -- (clear the execution stack.)
.singlestep: .singlestep => -- (put execution control into singlestep mode.)
.runfree
: .runfree => -- (take execution control out of singlestep mode.)
.quit
: .quit => -- (save virtual memory and exit to the operating system.)

Array Related Commands

.array
: <i> .array => <a> (new array of length i.)
.subarray
: <a><i><j> .subarray => <a’> (a’ is the subarray of a starting at position i and with
length j.)
.aput
: <a><i><v> .aput => -- (store v in the ith position of a.)
.aget
: <a><i> .aget => <v> (get v from the ith position of a.)
.aload
: <a> .aload =>
.astore
: <x1><x2> ... <xi><a> .astore => <a> (store x1 ... xi into array a of length i.)
.arrayforall: <a><x>.dictforall => -- (puts the contents of a
i on the stack, and then executes <x>.
This is done for every ai pair in array a)

Input/Output and Stream Related Commands

.print
: <s> .print => -- (.prints the string s on the current output stream.)
.bytestream: <filename> <access> .bytestream => <bs> (this command creates a bytestream with the
access characteristics represented by <access>. Here
<access> = 1 for read, 2 for write, 4 for append -- or
the sum of any of these. The created stream type object
is left on the operand stack.)
.keystream : .keystream => <ks> (this command creates a keystream and leaves it on the operand
stack.)
.killstream: <t> .killstream => (this command kills the given stream.)
.writebytes: <t><s> .writebytes => -- (write bytes in string s appended to stream t.)
.loadbcd
: <filename> .loadbcd => -- (load mesa bcd and start.)

Attribute Related Commands

.type
: <x> .type => <NameOfType> (deliver the name of the type on top of operand stack.
Current types include. .nulltype, .intergertype,
.longintegertype, .realtype, .booleantype, .stringtype,
.stringlittype, .streamtype, .streamlittype, .arraytype,
.arraylittype, .dicttype, .commandtype, .stacktype,
.frametype.)
.length
: <x> .length => <i> (length of: string (in characters); array (in elements); dictionary
(in entries).)
.cvs
: <x> .cvs => <s> (convert to string equivalent.)
.cvis
: <x><s> .cvis => <s> (convert into given string space. This command will use s for all
number and boolean conversions.)
.cvlit
: <x> .cvlit => <xl> (convert into literal form -- works for strings, and arrays.)

Scanner and String Manipulation Commands

.token
: <s> .token => <sr><t> (strip first token from given stream or string. Return remainder
and token on the stack. If no token, then return only a NullType
Object.)