-
Notifications
You must be signed in to change notification settings - Fork 2
Bite API
The BiteCompiler is responsible for taking code and compiling it into a BiteProgram that gets executed on the BiteVM.
BiteProgram Compile( IEnumerable < string > modules )Compiles a set of modules and returns a BiteProgram.
BiteProgram Compile( IReadOnlyCollection < Module > modules )Compiles a set of modules encapsulated in a Module class and returns a BiteProgram. This allows you to set the Name and Imports of a module in a way you can control in your code.
BiteProgram CompileStatements( string statements, SymbolTable symbolTable = null )Compiles a statement or set of statements into a default module named "MainModule" and returns a BiteProgram. Pass in the SymbolTable of a previous BiteProgram to retain the symbol information.
This is used in the REPL for example, to compile new statements into a program that get executed an existing BiteVM.
BiteProgram CompileExpression( string expression )Compiles a single expression into a default module named "MainModule" and returns a BiteProgram.
This is currently only used for unit testing.
A BiteProgram contains compiled bytecode.
BiteResult Run( Dictionary <string, object> externalObjects = null )A convenience method that creates a BiteVM, executes the BiteProgram and returns the status of execution and last value on the stack (if any) in a BiteResult.
BiteResult Run( CancellationToken cancellationToken, Dictionary < string, object > externalObjects = null )A convenience method that creates a BiteVM, executes the BiteProgram and returns the status of execution and last value on the stack (if any) in a BiteResult.
Task < BiteResult > RunAsync( CancellationToken cancellationToken, Dictionary < string, object > externalObjects = null )void InitVm()BiteVmInterpretResult Interpret( BiteProgram context )void RegisterExternalGlobalObject( string varName, object data )void RegisterCallable( string linkId, IBiteVmCallable callable )void ResetVm()