Class: DataModel

MVM. DataModel

The data management subsystem of MVM. It works by maintaining a stack of scope frames - themselves parts of a wider scope tree. Variable modifications are made by chaining up parent scopes when necessary.

new DataModel()

Author:
  • FelixMcFelix (Kyle S.)
Source:

Methods

call(argc, rel, ret) → {MVM.DataModel}

Call a function at another point in the code, moving any relevant data into the new MVM.StackFrame.
Parameters:
Name Type Description
argc number the amount of arguments to copy into the new scope.
rel number the relative height in scope frames of where the function declaration occurred.
ret number the address the MVM.VM must return to once the function ends.
Source:
Returns:
Returns self to allow for some degree of method chaining.
Type
MVM.DataModel

current() → {MVM.StackFrame}

Retrieve the currently active scope frame.
Source:
Returns:
Type
MVM.StackFrame

enter() → {MVM.DataModel}

Enter a new MVM.StackFrame - signifying a new block scope.
Source:
Returns:
Returns self to allow for some degree of method chaining.
Type
MVM.DataModel

exit() → {MVM.DataModel}

Leave the current MVM.StackFrame - signifying an end to a block scope.
Source:
Returns:
Returns self to allow for some degree of method chaining.
Type
MVM.DataModel

funcreturn(value) → {number}

Return from the current function, moving back to the original scope.
Parameters:
Name Type Description
value * the value to place into the MVM.StackFrame which we are returning to.
Source:
Returns:
The return address that the MVM.VM must utilise.
Type
number

relative(count) → {MVM.StackFrame}

Retrieve the scope frame a set height above the current frame, where 0 retrieves the current frame.
Parameters:
Name Type Description
count number the target relative height to retrieve a scope frame from.
Source:
Returns:
Type
MVM.StackFrame