Content deleted Content added
m WP:CHECKWIKI error fixes, added uncategorised, deadend tags using AWB |
WP:CHECKWIKI error fix #94. Stray ref tag. Do general fixes and cleanup if needed. -, typo(s) fixed: Arguement → Argument (17), equivilent → equivalent, fundemental → fu using AWB (12082) |
||
Line 24:
=== Runtime ===
====
The runtime context keeps track of
* The operating stack
Line 34:
** Data structure that holds the references to variable containers, also proving the interface for Namespace Levels.
*** refer to NAMESPACE DEFINITION
*
** Arguments to function calls are pushed on to this stack, flushed on call.
*** refer to STACK DEFINITION, FUNCTION DEFINITION
Line 43:
This context gives definition to an 'environment' where code is executed.
====
A key part to any operational computer language is the notion of a 'Namespace'.
Line 58:
* Implicitly move in/out of scopes
The scope
Namespace|Scope
Line 77:
Level 2: Namespace level, where Local Level is at 2, LSB == '0'.
Global scope names (LSB == 1 in the scope
through the runtime as they handle all function definitions, objects, and
names declared in the global scope. The "Local Level" is at where references
that have a scope
The Namespace
When the namespace
The global namespace is 1 by default, and any other namespaces must be declared
by using the
====
Variables in this definiton provide the following mechanims:
Line 93:
* Provide a distinguishable area of typed data
* Provide a generic container around typed data, to allow for labeling
* Declare a set of
** Allocate the proper space of memory for the given data type,
** Deallocate the space of memory a variables data may take up, and
Line 110:
scope in terms of ___location within a given set of scopes. This is what is called
'Ownership'. In a given runtime, variable containers can exist in the following
structures: A stack instance, Bytecode
The concept of ownership differentiates variables existing on one or more of the
Line 117:
structures.
====
Functions in this virtual machine are a pointer to a set of instructions in a
program with metadata about parameters defined.
====
In this paradigm, objects are units that encapsulate a
collection of methods.
====
Bytecode is arranged in the following order:
Line 134:
Where the <opcode> is a single byte denoting which subroutine to call with the
following
lengths, some having 0
'''Interpreting Bytecode Instructions'''
A bytecode instruction is a single-byte opcode, followed by at maximum 3
* Static (single byte)
Line 148:
** i.e. FF FF 00 <0xFFFF bytes of data>,
** 01 00 <0x1 bytes of data>,
** 06 00 <0x6 bytes of data>, etc.
Below is the specification of all the instructions with a short description for
Line 158:
TOS - 'Top Of Stack' The top element
TBI - 'To be Implemented'
S<[variable]> - Static
N<[variable]> - Name.
A<[variable]> - Address
D<[variable]> - Dynamic bytecode
----
Hex | Memnonic | arguments - description
Line 176:
'''2 - Variable management'''
----
20 DEC S<scope> S<type> N
21 LOV S<scope> N
22 STV S<scope> N
23 CTV S<scope> N
24 CTS D<data> - loads constant into stack
----
Line 247:
7D ERR - Start error block, uses TOS to evaluate error TBI
7E DONE - End of block
7F CALL N
----
'''8 - Generic object interface. Expects object on TOS'''
Line 258:
82 CALLM N<name> - Calls method in object
83 INDEXO - Index an object, uses
84 MODO S<OP> - Modify an object based on op. [+, -, *, /, %, ^ .. etc.]
----
F - Functions/classes
----
FF DEFUN
function. D
the return value, D<args> is the args.
FE DECLASS
FD DENS S
F2 ENDCLASS - End of class block
F1 NEW S<scope> N
F0 RETURN - Returns from function
Line 282:
00 NULL - No-op
01 LC N<name> - Calls OS function library, i.e. I/O, opening files, etc. TBI
02 PRINT - Prints whatever is on the TOS.
Line 288:
03 DEBUG - Toggle debug mode
0E ARGB - Builds
0F PC S
primitive subroutines providing methods to tweak
objects this bytecode set cannot touch. Uses argstack.
Line 296:
=== Compiler/Translator/Assembler ===
====
Going from code to bytecode is what this section is all about. First off an
Line 344:
The various instruction nodes within the tree will call specific functions
that will take arguemets specified and lookahead and lookbehind to formulate the
correct bytecode
==References==
|