Documentation
¶
Overview ¶
Package compiler is used to compile an Abstract Syntax Tree (AST) into its corresponding bytecode.
Index ¶
Constants ¶
const ( // MaxArgs is the maximum number of arguments a function can have. MaxArgs = 255 // Placeholder is a temporary value written during compilation, which is // always replaced before compilation is complete. Placeholder = uint16(math.MaxUint16) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
Compiler is used to compile Risor AST into its corresponding bytecode. This implements the ICompiler interface.
func New ¶
New creates and returns a new Compiler. Any supplied options are used to configure the compilation process.
func (*Compiler) CurrentInstructions ¶
CurrentInstructions returns the compiled instructions for the code that is currently being compiled. This may be the main code object, or it may be a function that is being compiled.
func (*Compiler) MainInstructions ¶
MainInstructions returns the compiled instructions for the main code object.
type Option ¶
type Option func(*Compiler)
Option is a configuration function for a Compiler.
func WithBuiltins ¶
WithBuiltins configures the compiler with the given built-in objects.