ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
VirtualMachine Struct Reference

Description:

This type implements a very simple stack machine that understands just four commands (!) plus a fifth to execute sub-programs.

This class is part of module ALib Expressions. It is not too well documented as it resides in a detail namespace and is not to be used from the outside expression API.

Definition at line 30 of file virtualmachine.hpp.

#include <virtualmachine.hpp>

Inner Type Index:

class  Command
 A command of the VM. More...
 

Public Type Index:

using PC = integer
 Type definition for a program counter.
 

Public Static Method Index:

static ALIB_API AString DbgList (Program &program)
 
static ALIB_API ASTDecompile (Program &program, MonoAllocator &allocator)
 
static ALIB_API alib::Box Run (Program &program, Scope &scope)
 
static ALIB_API void run (Program &program, Scope &scope)
 

Type Definition Details:

◆ PC

using PC = integer

Type definition for a program counter.

Definition at line 33 of file virtualmachine.hpp.

Method Details:

◆ DbgList()

AString DbgList ( Program & program)
static

Lists a virtual machine program.

Note: This method is available only with debug-builds of the library.

Parameters
programThe program to list.
Returns
The program listing.

Definition at line 516 of file virtualmachine.cpp.

Here is the call graph for this function:

◆ Decompile()

AST * Decompile ( Program & program,
MonoAllocator & allocator )
static

Static method that decompiles a program into an abstract syntax tree. Used to generate optimized, normalized, parsable expression strings.

Parameters
programThe program to decompile.
allocatorAllocator for AST objects (and their data).
Returns
The abstract syntax tree as a result of de-compilation.

Definition at line 347 of file virtualmachine.cpp.

Here is the call graph for this function:

◆ Run()

Box Run ( Program & program,
Scope & scope )
static

Static method that runs an expression program.

Parameters
programThe program to run.
scopeThe scope to use.
Returns
The result value of the expression program.

Definition at line 43 of file virtualmachine.cpp.

Here is the call graph for this function:

◆ run()

void run ( Program & program,
Scope & scope )
static

The implementation of Run, which itself is just initialization code.

Parameters
programThe program to run.
scopeThe scope to use.

Definition at line 64 of file virtualmachine.cpp.

Here is the call graph for this function:

The documentation for this struct was generated from the following files: