The compiler class. This holds a set of compiler options and constructs executable objects (e.g. PointExecutable or VolumeExecutable) from a syntax tree or snippet of code.
More...
#include <openvdb_ax/compiler/Compiler.h>
The compiler class. This holds a set of compiler options and constructs executable objects (e.g. PointExecutable or VolumeExecutable) from a syntax tree or snippet of code.
- Note
- Compilers cannot be copied and it is unsafe to call compile() methods concurrently on instances of the same compiler (due to access into the function registry currently not being thread safe). It is safe to create new instances of a Compiler to compile programs concurrently.
Construct a compiler object with given settings.
- Parameters
-
Compile a given AST into an executable object of the given type.
- Parameters
-
syntaxTree | An abstract syntax tree to compile |
logger | Logger for errors and warnings during compilation, this should be linked to an ast::Tree and populated with AST node + line number mappings for this Tree, e.g. during ast::parse(). This Tree can be different from the syntaxTree argument. |
data | Optional external/custom data which is to be referenced by the executable object. It allows one to reference data held elsewhere, such as inside of a DCC, from inside the AX code |
- Note
- If the logger has not been populated with AST node and line mappings, all messages will appear without valid line and column numbers.
Compile a given snippet of AX code into an executable object of the given type.
- Parameters
-
code | A string of AX code |
logger | Logger for errors and warnings during compilation, will be cleared of existing data |
data | Optional external/custom data which is to be referenced by the executable object. It allows one to reference data held elsewhere, such as inside of a DCC, from inside the AX code |
- Note
- If compilation is unsuccessful, will return nullptr. Logger can then be queried for errors.
Compile a given snippet of AX code into an executable object of the given type.
- Parameters
-
code | A string of AX code |
data | Optional external/custom data which is to be referenced by the executable object. It allows one to reference data held elsewhere, such as inside of a DCC, from inside the AX code |
- Note
- Parser errors are handled separately from compiler errors. Each are collected and produce runtime errors.
Compile a given AST into an executable object of the given type.
- Parameters
-
syntaxTree | An abstract syntax tree to compile |
data | Optional external/custom data which is to be referenced by the executable object. It allows one to reference data held elsewhere, such as inside of a DCC, from inside the AX code |
- Note
- Any errors encountered are collected into a single runtime error
Static method for creating Compiler objects.
Sets the compiler's function registry object.
- Parameters
-
functionRegistry | A unique pointer to a FunctionRegistry object. The compiler will take ownership of the registry that was passed in. |