compiler

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package compiler translates the ast structures that represent the parsed course code into instructions that can be executed by the VM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileFunc

func CompileFunc(fn *ast.Func, fns map[string]*ast.Func) (*vm.CompiledFunc, error)

CompileFunc translates a single function into a set of instructions. The number of instructions returned may be zero.

func CompileTest

func CompileTest(fn *ast.Test, fns map[string]*ast.Func) (*vm.CompiledTest, error)

CompileTest will compile a test.

Types

type Compiled

type Compiled struct {
	Funcs    map[string]*vm.CompiledFunc
	FuncDefs map[string]*ast.Func
	Tests    []*vm.CompiledTest
}

CompiledFile contains all the compiled entities in a file.

func CompileFile

func CompileFile(f *parser.File) (*Compiled, error)

CompileFile translates a single file into a set of instructions. The number of instructions returned may be zero.

func CompilePackage

func CompilePackage(dir string, includeTests bool) (*Compiled, []error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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