compiler

package
v0.18.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 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, file *Compiled) (*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, file *Compiled) (*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
	Interfaces map[string]map[string]string
	Constants  map[string]*ast.Literal
}

CompiledFile contains all the compiled entities in a file.

func CompileFile

func CompileFile(f *parser.File, interfaces map[string]map[string]string, constants map[string]*ast.Literal) (*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