Compilation and execution
Let's see how to use the Gentee compiler and virtual machine in projects in the Go programming language.
Compilation
To get started, you need to create the Gentee structure using the New function. This structure will store all information about compiled scripts. You just need to create one instance and compile any number of scripts.
To compile scripts, you need to use the methods Compile, CompileFile, CompileAndRun. The methods Compile, CompileFile, in case of successful compilation, return the structure Exec, which contains the bytecode. You can save or pass this structure for later execution using the Run method. The CompileAndRun method immediately after compilation executes the script and returns its result.
Bytecode Execution
The ready byte code of the script is stored in a structure of the Exec type. To execute it, call the Run method. The parameter of the type Settings allows you to pass command line parameters and specify additional settings for the virtual machine.
Last updated