ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
VirtualMachine Class Reference

Description:


This class 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 37 of file virtualmachine.hpp.

#include <virtualmachine.hpp>

Inner Type Index:

class  Command
 

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 41 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 520 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 decompilation.

Definition at line 354 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 57 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 79 of file virtualmachine.cpp.

Here is the call graph for this function:

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