Commands in Kernel Version 1.2.2.02

Die folgende Tabelle gibt einen Überblick der wichtigsten Anweisungen und ihrer Auswirkungen auf dem Stack. Die letzte Spalte ist eine Kurzbeschreibung der Tätigkeit des Commands.

Für die Darstellung der Stacksituation gilt:

Stacksituation vorher --> Stacksituation nachher

Die Reihenfolge der Elemente ist so zu verstehen, dass ganz links das oben auf dem Stack liegende Element vorhanden ist. Diese Position nennt sich Top Of Stack oder einfach TOS.

Name

Stacksituationen

Beschreibung

.

obj -->

Takes an object from the Top Of the Stack (TOS) and prints it to the V2M output stream; by default the console. The dot-command is consumptive, that means the object is taken away from the stack and then printed.

.S


Displays the stack content with TOS at first position in line.

word

--> true str
--> false

Takes the next sequence of characters with no white spaces and puts it as a String onto the Stack followed by a boolean true . If there was no sequence only false is on TOS.

+

num1 num2 --> num
str1 str2 --> str
Adds two numbers and pushes back the sum.
Concatenates str2 to str1 and pushes back the new string.

*

num1 num2 --> num
flg1 flg2 --> flg
Multiplies two numbers and pushes back he product.
Pushes back the conjunction of two booleans.

-

num1 num2 --> num

Pushes back the difference of num1 - num2.

/

num1 num2 --> num

Pushes back the quotient of num1 / num2.

not

int --> int
flg --> flg
Pushes back the 1's complement of an integer.
Pushes back the negation of a boolean.

and

int1 int2 --> int
flg1 flg2 --> flg
Pushes back the bitwise conjunction of two integers.
Pushes back the conjunction of two booleans.

or

num1 num2 --> num
flg1 flg2 --> flg
Pushes back the bitwise disjunction of two integers.
Pushes back the conjunction of two booleans.

=

num1 num2 --> flg
flg1 flg2 --> flg
str1 str2 --> flg
chr1 chr1 --> flg

Pushes back true if the two objects are equal, false otherwise.

<=

num1 num2 --> flg
flg1 flg2 --> flg
chr1 chr1 --> flg

Pushes back true if ob1 less or equal obj2, false otherwise.

<

num1 num2 --> flg
flg1 flg2 --> flg
chr1 chr1 --> flg

Pushes back true if ob1 less obj2, false otherwise.

>

num1 num2 --> flg
flg1 flg2 --> flg
chr1 chr1 --> flg

Pushes back true if ob1 greater obj2, false otherwise.

>=

num1 num2 --> flg
flg1 flg2 --> flg
chr1 chr1 --> flg

Pushes back true if ob1 greater or equal obj2, false otherwise.

<>

num1 num2 --> flg
flg1 flg2 --> flg
str1 str2 --> flg
chr1 chr1 --> flg

Pushes back true if ob1 not equal obj2, false otherwise.

dup

obj --> obj obj

Duplicates the object on top of the Stack

drop

obj -->

Removes the object from top of the Stack

swap

obj1 obj2 --> obj2 obj1

Reverses the order of the two elements on top of the stack.

ndrop

obj1 ... objn --> obj1 ...

Removes the n_th object under the top of stack from stack. If n is 0 a simple drop is done.

ndup

obj1 obj2 ... objn--> objn ...

Copies the n_th object under top of stack to top of stack. If n is 0 a simple dup is done.

nswap

obj1 ... objn --> objn obj1

Changes the n_th object under the top of stack with the object on top f stack.

variable


Creates a new variable with the name of the following non spaced character sequence.

is

object var-->

Makes the variable var to be the object. Could be seen as storing the object into the variable var.

free

name -->

Frees he variable, which name is on top of stack.

classify

name --> class

Pushes back a class object with the specified name.

instantiate

class -- object

Pushes back an instance of the given class.

field

name object --> field

Makes a field of an instance available for V2M with the name of the following non spaced character sequence. The behavior is same to the variable but type depending.

fetch

name object --> value

Pushes back the content of the named field of an instance.

store

name object value -->

Stores the value in a named field of an object. Similar to put.

method

object name --> method

Makes a method of an instance available for V2M with the name of the following non spaced character sequence.

call

method --> obj

Starts the method. Consumes arguments from stack and pushes back the return value.

creator

name -> creator

Pushes back the creator-method.

build

creator --> object

Calls the creator-method and pushes back the instance.

find

name --> true command
name --> false

Searches for a command with given name and pushes back true and the found command or false if not found.

compile

command -->

Compiles the command on top of stack.

bind


Binds the compiled sequence to the last entry in the vocabulary.

entry

string -->

Creates a new vocabulary entry with the name top of stack.

execute

command -->

Executes the command on stack.

symbol

name --> true symbol
name --> false

Test if the string on stack is a symbol and pushes back true and a symbol or false if not.

type

object --> string

Pushes back the type of an object as string.

(double)

num --> double

Casts the content of any numeric symbol to subengine type double.

(float)

num --> float

Casts the content of any numeric symbol to subengine type float.

(long)

num --> long

Casts the content of any numeric symbol to subengine type long.

(int)

num --> integer

Casts the content of any numeric symbol to subengine type integer.

(short)

num --> short

Casts the content of any numeric symbol to subengine type short.

(byte)

num --> byte

Casts the content of any numeric symbol to subengine type byte.

commands


Gives a list of all existing commands in the vocabulary, starting with the last defined.

forget


Gets the name of the following non spaced character sequence as a command name and forgets this and all following commands.

load

name -->

Takes the file with the name on stack as new input stream. Continues with origin after file is done.

environment

--> v2m

Pushes back the V2M as an instance of it's own.

newline

--> "\n"

Simply gives a new_line character as a string

if


If true was on stack the commands between if and else or endif are processed.

else


If false was on stack at if-time the commands between else and endif are processed.

endif


Closes a if-else construct.

loop


Start of a loop.

leave


If true is on stack the eaves the loop and continues behind endloop.

endloop


Closes a loop.

exit


Exits the command. Similar to return in normal languages.