-
-
Notifications
You must be signed in to change notification settings - Fork 1
Start Theory
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.
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:
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 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 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 almost how default class. But it haven`t constructors and destructors. Other release how in default classes.
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>
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.
Some text translate with help of Google.Translate
If you want to more quality info on all languages -> go to official page of WoL VM