compiler

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package compiler translates syntax trees into bytecode for the stack machine. It resolves names (locals, parameters, captured variables, members, then top-level names), checks the language's rules (the "Rule:" comments of syntax.ebnf), evaluates constants and generates the code of every function, member function and function literal, together with the prelude that defines class Error.

Index

Constants

View Source
const PreludeName = "<prelude>"

PreludeName is the file name of the prelude in positions and traces.

Variables

This section is empty.

Functions

func Compile

func Compile(files []*ast.File, builtins []string) (prog *bytecode.Program, err error)

Compile compiles the files of one program, in order. builtins lists the names of the built-in functions. A file with a Module name belongs to that module; a module must come before the files that use it (the loader orders them so).

func CompileWith added in v0.2.0

func CompileWith(files []*ast.File, builtins []string, config *native.Config) (prog *bytecode.Program, err error)

CompileWith is Compile for a program limited by config: its own native modules, the registered modules it may use, the built-ins it may not.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL