|
Bond 0.9
C++ Bond Runtime Library API Documentation
|
A code generator for the Bond scripting language. More...
#include <bond/compiler/codegenerator.h>
Public Member Functions | |
| CodeGenerator (Allocator &allocator, CompilerErrorBuffer &errorBuffer, PointerSize pointerSize=BOND_NATIVE_POINTER_SIZE) | |
| Constructs a CodeGenerator object. | |
| ~CodeGenerator () | |
| Destroys a CodeGenerator object. | |
| void | Generate (const TranslationUnit *translationUnitList, OutputStream &stream) |
| Generates bytecode for a list of parse trees. | |
A code generator for the Bond scripting language.
The CodeGenerator traverses the given parse tree and compiles it to bytecode that can be interpreted by a virtual machine. The bytecode is written to the given OutputStream in the CBO file format.
|
inline |
Constructs a CodeGenerator object.
| allocator | Allocator used for temporary memory allocations made by the Generate method. |
| errorBuffer | Buffer where error messages are pushed when code generation errors are encountered. |
| pointerSize | Size of pointers used by the target virtual machine that will execute the Bond bytecode. It is required to generate correct pointer arithmetic instructions for the target platform. |
|
inline |
Destroys a CodeGenerator object.
| void Bond::CodeGenerator::Generate | ( | const TranslationUnit * | translationUnitList, |
| OutputStream & | stream ) |
Generates bytecode for a list of parse trees.
Code is generated only for the TranslationUnits that require it. Global initializers whose values cannot be determined at compile time are combined into a single static initializer, in list order and then declaration order within each TranslationUnit.
| translationUnitList | A linked list of parse trees to be compiled to bytecode. |
| stream | OutputStream to which the generated bytecode is written in the CBO file format. |