std::pyro
A utility module for interacting with the Pyro VM.
Variables
-
module_cache: map[str, module]
-
The VM's cache of imported modules, indexed by import path.
-
version_string: str
-
The language version as a string.
-
version_tuple: tup[i64, i64, i64, str, str]
-
The language version as a tuple containing
(MAJOR, MINOR, PATCH, LABEL, BUILD)
elements.-
MAJOR
,MINOR
, andPATCH
are semantic versioning integers. -
LABEL
is a string containing a pre-release label, e.g."alpha1"
,"beta2"
,"rc3"
. May be an empty string. -
BUILD
is a string containing build information, e.g."release"
,"debug"
. May be an empty string.
-
Functions
-
address(arg: any) -> str|err
-
Returns the memory address of
arg
as an uppercase hex-encoded string prefixed with0x
, e.g.0x600002FBE5B0
.Returns an
err
ifarg
is not a heap-allocated object. -
gc()
-
Runs the garbage collector.
-
load_embedded_file(path: str) -> buf
-
Loads a file embedded in the Pyro binary.
The
path
argument is the relative path of the file within theembed
directory — e.g. for the source file located atembed/foo/bar.txt
the
path
argument should befoo/bar.txt
Panics if the file cannot be located.
-
memory() -> i64
-
Returns the VM's current memory allocation in bytes.
-
path() -> str
-
Returns the filepath of the Pyro binary.