ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Types | Inner Classes | Public Static Methods | List of all members
VirtualMachine Class Reference

#include <virtualmachine.hpp>

Class 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.

Public Types

using PC = integer
 Type definition for a program counter.
 

Inner Classes

class  Command
 

Public Static Methods

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

Member Function Documentation

◆ 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 517 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 351 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 54 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 76 of file virtualmachine.cpp.

Here is the call graph for this function:

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