compiler

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package compiler translates syntax trees into bytecode for the stack machine. It also resolves names (locals, parameters, temporaries, then top-level names) and evaluates constants.

Milestone 3 supports: functions with required parameters and temporaries, global and constant declarations, locals, expressions on numbers, strings and booleans, calls, if/elseif/else, while, do-while, for, break, continue and return. Other constructs are reported as "not supported yet".

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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