compiler

package
v0.14.5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const RuntimeModuleName = "crt"

Variables

This section is empty.

Functions

func GenerateWasm

func GenerateWasm(funcs []*ir.Func) *wasm.Module

Types

type Compiler

type Compiler struct {
	Checker *sema.Checker
	// contains filtered or unexported fields
}

func NewCompiler

func NewCompiler(checker *sema.Checker) *Compiler

func (*Compiler) VisitArrayExpression

func (compiler *Compiler) VisitArrayExpression(_ *ast.ArrayExpression) ast.Repr

func (*Compiler) VisitAssignmentStatement

func (compiler *Compiler) VisitAssignmentStatement(_ *ast.AssignmentStatement) ast.Repr

func (*Compiler) VisitBinaryExpression

func (compiler *Compiler) VisitBinaryExpression(expression *ast.BinaryExpression) ast.Repr

func (*Compiler) VisitBlock

func (compiler *Compiler) VisitBlock(block *ast.Block) ast.Repr

func (*Compiler) VisitBoolExpression

func (compiler *Compiler) VisitBoolExpression(_ *ast.BoolExpression) ast.Repr

func (*Compiler) VisitBreakStatement

func (compiler *Compiler) VisitBreakStatement(_ *ast.BreakStatement) ast.Repr

func (*Compiler) VisitCastingExpression

func (compiler *Compiler) VisitCastingExpression(_ *ast.CastingExpression) ast.Repr

func (*Compiler) VisitCompositeDeclaration

func (compiler *Compiler) VisitCompositeDeclaration(_ *ast.CompositeDeclaration) ast.Repr

func (*Compiler) VisitCondition

func (compiler *Compiler) VisitCondition(_ *ast.Condition) ast.Repr

func (*Compiler) VisitConditionalExpression

func (compiler *Compiler) VisitConditionalExpression(_ *ast.ConditionalExpression) ast.Repr

func (*Compiler) VisitContinueStatement

func (compiler *Compiler) VisitContinueStatement(_ *ast.ContinueStatement) ast.Repr

func (*Compiler) VisitCreateExpression

func (compiler *Compiler) VisitCreateExpression(_ *ast.CreateExpression) ast.Repr

func (*Compiler) VisitDestroyExpression

func (compiler *Compiler) VisitDestroyExpression(_ *ast.DestroyExpression) ast.Repr

func (*Compiler) VisitDictionaryExpression

func (compiler *Compiler) VisitDictionaryExpression(_ *ast.DictionaryExpression) ast.Repr

func (*Compiler) VisitEmitStatement

func (compiler *Compiler) VisitEmitStatement(_ *ast.EmitStatement) ast.Repr

func (*Compiler) VisitEnumCaseDeclaration

func (compiler *Compiler) VisitEnumCaseDeclaration(_ *ast.EnumCaseDeclaration) ast.Repr

func (*Compiler) VisitExpressionStatement

func (compiler *Compiler) VisitExpressionStatement(_ *ast.ExpressionStatement) ast.Repr

func (*Compiler) VisitFieldDeclaration

func (compiler *Compiler) VisitFieldDeclaration(_ *ast.FieldDeclaration) ast.Repr

func (*Compiler) VisitFixedPointExpression

func (compiler *Compiler) VisitFixedPointExpression(_ *ast.FixedPointExpression) ast.Repr

func (*Compiler) VisitForStatement

func (compiler *Compiler) VisitForStatement(_ *ast.ForStatement) ast.Repr

func (*Compiler) VisitForceExpression

func (compiler *Compiler) VisitForceExpression(_ *ast.ForceExpression) ast.Repr

func (*Compiler) VisitFunctionBlock

func (compiler *Compiler) VisitFunctionBlock(_ *ast.FunctionBlock) ast.Repr

func (*Compiler) VisitFunctionDeclaration

func (compiler *Compiler) VisitFunctionDeclaration(declaration *ast.FunctionDeclaration) ast.Repr

func (*Compiler) VisitFunctionExpression

func (compiler *Compiler) VisitFunctionExpression(_ *ast.FunctionExpression) ast.Repr

func (*Compiler) VisitIdentifierExpression

func (compiler *Compiler) VisitIdentifierExpression(expression *ast.IdentifierExpression) ast.Repr

func (*Compiler) VisitIfStatement

func (compiler *Compiler) VisitIfStatement(_ *ast.IfStatement) ast.Repr

func (*Compiler) VisitImportDeclaration

func (compiler *Compiler) VisitImportDeclaration(_ *ast.ImportDeclaration) ast.Repr

func (*Compiler) VisitIndexExpression

func (compiler *Compiler) VisitIndexExpression(_ *ast.IndexExpression) ast.Repr

func (*Compiler) VisitIntegerExpression

func (compiler *Compiler) VisitIntegerExpression(expression *ast.IntegerExpression) ast.Repr

func (*Compiler) VisitInterfaceDeclaration

func (compiler *Compiler) VisitInterfaceDeclaration(_ *ast.InterfaceDeclaration) ast.Repr

func (*Compiler) VisitInvocationExpression

func (compiler *Compiler) VisitInvocationExpression(_ *ast.InvocationExpression) ast.Repr

func (*Compiler) VisitMemberExpression

func (compiler *Compiler) VisitMemberExpression(_ *ast.MemberExpression) ast.Repr

func (*Compiler) VisitNilExpression

func (compiler *Compiler) VisitNilExpression(_ *ast.NilExpression) ast.Repr

func (*Compiler) VisitPathExpression

func (compiler *Compiler) VisitPathExpression(_ *ast.PathExpression) ast.Repr

func (*Compiler) VisitPragmaDeclaration

func (compiler *Compiler) VisitPragmaDeclaration(_ *ast.PragmaDeclaration) ast.Repr

func (*Compiler) VisitProgram

func (compiler *Compiler) VisitProgram(_ *ast.Program) ast.Repr

func (*Compiler) VisitReferenceExpression

func (compiler *Compiler) VisitReferenceExpression(_ *ast.ReferenceExpression) ast.Repr

func (*Compiler) VisitReturnStatement

func (compiler *Compiler) VisitReturnStatement(statement *ast.ReturnStatement) ast.Repr

func (*Compiler) VisitStringExpression

func (compiler *Compiler) VisitStringExpression(e *ast.StringExpression) ast.Repr

func (*Compiler) VisitSwapStatement

func (compiler *Compiler) VisitSwapStatement(_ *ast.SwapStatement) ast.Repr

func (*Compiler) VisitSwitchStatement

func (compiler *Compiler) VisitSwitchStatement(_ *ast.SwitchStatement) ast.Repr

func (*Compiler) VisitTransactionDeclaration

func (compiler *Compiler) VisitTransactionDeclaration(_ *ast.TransactionDeclaration) ast.Repr

func (*Compiler) VisitUnaryExpression

func (compiler *Compiler) VisitUnaryExpression(_ *ast.UnaryExpression) ast.Repr

func (*Compiler) VisitVariableDeclaration

func (compiler *Compiler) VisitVariableDeclaration(declaration *ast.VariableDeclaration) ast.Repr

func (*Compiler) VisitWhileStatement

func (compiler *Compiler) VisitWhileStatement(_ *ast.WhileStatement) ast.Repr

type Local

type Local struct {
	Index uint32
	Type  ir.ValType
}

func NewLocal

func NewLocal(index uint32, valType ir.ValType) *Local

type LocalActivation added in v0.14.0

type LocalActivation struct {
	Depth  int
	Parent *LocalActivation
	// contains filtered or unexported fields
}

A LocalActivation is a map of strings to values. It can be used to represent an active scope in a program, i.e. it can be used as a symbol table during semantic analysis, or as an activation record during interpretation or compilation.

func NewLocalActivation added in v0.14.0

func NewLocalActivation(parent *LocalActivation) *LocalActivation

func (*LocalActivation) Find added in v0.14.0

func (a *LocalActivation) Find(name string) *Local

Find returns the value for a given name in the activation. It returns nil if no value is found.

func (*LocalActivation) Set added in v0.14.0

func (a *LocalActivation) Set(name string, value *Local)

Set sets the given name-value pair in the activation.

type LocalActivations added in v0.14.0

type LocalActivations struct {
	// contains filtered or unexported fields
}

Activations is a stack of activation records. Each entry represents a new activation record.

The current / most nested activation record can be found at the top of the stack (see function `Current`).

func (*LocalActivations) Current added in v0.14.0

func (a *LocalActivations) Current() *LocalActivation

Current returns the current / most nested activation, which can be found at the top of the stack. It returns nil if there is no active activation.

func (*LocalActivations) CurrentOrNew added in v0.14.0

func (a *LocalActivations) CurrentOrNew() *LocalActivation

CurrentOrNew returns the current activation, or if it does not exists, a new activation

func (*LocalActivations) Depth added in v0.14.0

func (a *LocalActivations) Depth() int

Depth returns the depth (size) of the activation stack.

func (*LocalActivations) Find added in v0.14.0

func (a *LocalActivations) Find(name string) *Local

Find returns the value for a given key in the current activation. It returns nil if no value is found or if there is no current activation.

func (*LocalActivations) Pop added in v0.14.0

func (a *LocalActivations) Pop()

Pop pops the top-most (current) activation from the top of the activation stack.

func (*LocalActivations) Push added in v0.14.0

func (a *LocalActivations) Push(activation *LocalActivation)

Push pushes the given activation onto the top of the activation stack.

func (*LocalActivations) PushNewWithCurrent added in v0.14.0

func (a *LocalActivations) PushNewWithCurrent()

PushNewWithCurrent pushes a new empty activation to the top of the activation stack. The new activation has the current activation as its parent.

func (*LocalActivations) PushNewWithParent added in v0.14.0

func (a *LocalActivations) PushNewWithParent(parent *LocalActivation) *LocalActivation

PushNewWithParent pushes a new empty activation to the top of the activation stack. The new activation has the given parent as its parent.

func (*LocalActivations) Set added in v0.14.0

func (a *LocalActivations) Set(name string, value *Local)

Set sets the name-value pair in the current scope.

Directories

Path Synopsis
WebAssembly (https://webassembly.org/) is an open standard for portable executable programs.
WebAssembly (https://webassembly.org/) is an open standard for portable executable programs.
gen

Jump to

Keyboard shortcuts

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