The BLOCKS SDK
littlefoot::Compiler Struct Reference

Description

This class compiles littlefoot source code into a littlefoot::Program object which can be executed by a littlefoot::Runner.

Public Member Functions

 Compiler ()=default
 
void addNativeFunctions (const char *const *functionPrototypes)
 Gives the compiler a zero-terminated list of native function prototypes to use when parsing function calls. More...
 
template<typename RunnerType >
void addNativeFunctions (const RunnerType &runner)
 Tells the compiler to use the list of native function prototypes from this littlefoot::Runner object. More...
 
juce::Result compile (const juce::String &sourceCode, uint32 defaultHeapSize, const juce::Array< juce::File > &searchPaths={})
 Compiles a littlefoot program. More...
 
Program getCompiledProgram () const noexcept
 After a successful compilation, this returns the finished Program. More...
 

Static Public Member Functions

static juce::File resolveIncludePath (juce::String include, juce::Array< juce::File > searchPaths)
 

Public Attributes

juce::Array< uint8compiledObjectCode
 After a successful call to compile(), this contains the bytecode generated. More...
 

Constructor & Destructor Documentation

◆ Compiler()

littlefoot::Compiler::Compiler ( )
default

Member Function Documentation

◆ addNativeFunctions() [1/2]

void littlefoot::Compiler::addNativeFunctions ( const char *const *  functionPrototypes)

Gives the compiler a zero-terminated list of native function prototypes to use when parsing function calls.

◆ addNativeFunctions() [2/2]

template<typename RunnerType >
void littlefoot::Compiler::addNativeFunctions ( const RunnerType &  runner)

Tells the compiler to use the list of native function prototypes from this littlefoot::Runner object.

◆ compile()

juce::Result littlefoot::Compiler::compile ( const juce::String &  sourceCode,
uint32  defaultHeapSize,
const juce::Array< juce::File > &  searchPaths = {} 
)

Compiles a littlefoot program.

If there's an error, this returns it, otherwise the compiled bytecode is placed in the compiledObjectCode member.

◆ getCompiledProgram()

Program littlefoot::Compiler::getCompiledProgram ( ) const
noexcept

After a successful compilation, this returns the finished Program.

◆ resolveIncludePath()

static juce::File littlefoot::Compiler::resolveIncludePath ( juce::String  include,
juce::Array< juce::File >  searchPaths 
)
static

Member Data Documentation

◆ compiledObjectCode

juce::Array<uint8> littlefoot::Compiler::compiledObjectCode

After a successful call to compile(), this contains the bytecode generated.

A littlefoot::Program object can be created directly from this array.


The documentation for this struct was generated from the following file: