Skip to content

Start Theory

Alexander (Arkasha) edited this page Nov 4, 2019 · 5 revisions

Welcome to documentation for writing programs on WoL Virtual

We start from theory. When we run program in virtual machine - in vm creating context of thread: parse arguments of command line, load stack and add base classes and other more; and only then run code of your program. Virtual machine have one stack - mainstack.
This stack have three dictionaries:

  • Classes (their names and structures)
  • Variables (their names and values to which they point)
  • Functions (their names and structures)

Script is a list of expressions. Expression - is a string who have keyword (of expression) and arguments (of expression). And this expression can be executed in accordance with this keyword. The script may also not have a keyword but a function.


How release classes

Classes need for declaring type of values and other more. Class can have:

  • Constants (enum, struct)
  • Fields (all without enum and static)
  • Methods and static methods (all without enum)
  • Constructors (default and struct but in struct only private)
  • Destructors (default and struct)
  • Static fields (all without enum)

Class can have types:

Default classes

When to value add type (default class) he get copy of all fields of type. For example:
<field1 = <9:int>, field2 = <any value:string> : TestClass>

Struct

Struct have private constructors and constants. Constants have type of this struct and they have link on just value (list of fields) or on result of one from private constructors. When to value add type (structure) he get any constant of this type. For example:
<Constant1 : TestStruct>

Static classes

Static classes its how default class but have only one instance. And becouse it havent destructors and constructors. Else it havent default (non-static) fields. When to value add type (static class) he get copy of all fields of type. For example:
<field1 = <9:int>, field2 = <any value:string> : TestStatic>
It`s like a default class.

Abstract classes

Abstract classes almost how default class. But it haven`t constructors and destructors. Other release how in default classes.

Enum

Enumerations have only list of constants with type how parent. For example enum have parent - int (in default situation) and this enum will have list of contants with type int. When to value add type (enum) he get any constant who have in constants of his type (enum). For example:
<CONSTANT : TestEnum>


How release variables

Variables - it is pair "name-value". And therefore the variables do not have a specific data type in the virtual machine and are represented "abstractly". The main role in this play values.
Value - it is the "piece" of data and have:

  • Type and all its fields, methods, etc.
  • Getter (and setter) - functions which run on vm level (vm check this functions first and only after check other methods) and need for receive value (and transmit value).
    In common almost all actions with values occur with the types of these values.