Documentation ¶
Index ¶
- Constants
- func GenerateWasm(funcs []*ir.Func) *wasm.Module
- type Compiler
- func (compiler *Compiler) VisitArrayExpression(_ *ast.ArrayExpression) ast.Repr
- func (compiler *Compiler) VisitAssignmentStatement(_ *ast.AssignmentStatement) ast.Repr
- func (compiler *Compiler) VisitBinaryExpression(expression *ast.BinaryExpression) ast.Repr
- func (compiler *Compiler) VisitBlock(block *ast.Block) ast.Repr
- func (compiler *Compiler) VisitBoolExpression(_ *ast.BoolExpression) ast.Repr
- func (compiler *Compiler) VisitBreakStatement(_ *ast.BreakStatement) ast.Repr
- func (compiler *Compiler) VisitCastingExpression(_ *ast.CastingExpression) ast.Repr
- func (compiler *Compiler) VisitCompositeDeclaration(_ *ast.CompositeDeclaration) ast.Repr
- func (compiler *Compiler) VisitCondition(_ *ast.Condition) ast.Repr
- func (compiler *Compiler) VisitConditionalExpression(_ *ast.ConditionalExpression) ast.Repr
- func (compiler *Compiler) VisitContinueStatement(_ *ast.ContinueStatement) ast.Repr
- func (compiler *Compiler) VisitCreateExpression(_ *ast.CreateExpression) ast.Repr
- func (compiler *Compiler) VisitDestroyExpression(_ *ast.DestroyExpression) ast.Repr
- func (compiler *Compiler) VisitDictionaryExpression(_ *ast.DictionaryExpression) ast.Repr
- func (compiler *Compiler) VisitEmitStatement(_ *ast.EmitStatement) ast.Repr
- func (compiler *Compiler) VisitEnumCaseDeclaration(_ *ast.EnumCaseDeclaration) ast.Repr
- func (compiler *Compiler) VisitExpressionStatement(_ *ast.ExpressionStatement) ast.Repr
- func (compiler *Compiler) VisitFieldDeclaration(_ *ast.FieldDeclaration) ast.Repr
- func (compiler *Compiler) VisitFixedPointExpression(_ *ast.FixedPointExpression) ast.Repr
- func (compiler *Compiler) VisitForStatement(_ *ast.ForStatement) ast.Repr
- func (compiler *Compiler) VisitForceExpression(_ *ast.ForceExpression) ast.Repr
- func (compiler *Compiler) VisitFunctionBlock(_ *ast.FunctionBlock) ast.Repr
- func (compiler *Compiler) VisitFunctionDeclaration(declaration *ast.FunctionDeclaration) ast.Repr
- func (compiler *Compiler) VisitFunctionExpression(_ *ast.FunctionExpression) ast.Repr
- func (compiler *Compiler) VisitIdentifierExpression(expression *ast.IdentifierExpression) ast.Repr
- func (compiler *Compiler) VisitIfStatement(_ *ast.IfStatement) ast.Repr
- func (compiler *Compiler) VisitImportDeclaration(_ *ast.ImportDeclaration) ast.Repr
- func (compiler *Compiler) VisitIndexExpression(_ *ast.IndexExpression) ast.Repr
- func (compiler *Compiler) VisitIntegerExpression(expression *ast.IntegerExpression) ast.Repr
- func (compiler *Compiler) VisitInterfaceDeclaration(_ *ast.InterfaceDeclaration) ast.Repr
- func (compiler *Compiler) VisitInvocationExpression(_ *ast.InvocationExpression) ast.Repr
- func (compiler *Compiler) VisitMemberExpression(_ *ast.MemberExpression) ast.Repr
- func (compiler *Compiler) VisitNilExpression(_ *ast.NilExpression) ast.Repr
- func (compiler *Compiler) VisitPathExpression(_ *ast.PathExpression) ast.Repr
- func (compiler *Compiler) VisitPragmaDeclaration(_ *ast.PragmaDeclaration) ast.Repr
- func (compiler *Compiler) VisitProgram(_ *ast.Program) ast.Repr
- func (compiler *Compiler) VisitReferenceExpression(_ *ast.ReferenceExpression) ast.Repr
- func (compiler *Compiler) VisitReturnStatement(statement *ast.ReturnStatement) ast.Repr
- func (compiler *Compiler) VisitStringExpression(e *ast.StringExpression) ast.Repr
- func (compiler *Compiler) VisitSwapStatement(_ *ast.SwapStatement) ast.Repr
- func (compiler *Compiler) VisitSwitchStatement(_ *ast.SwitchStatement) ast.Repr
- func (compiler *Compiler) VisitTransactionDeclaration(_ *ast.TransactionDeclaration) ast.Repr
- func (compiler *Compiler) VisitUnaryExpression(_ *ast.UnaryExpression) ast.Repr
- func (compiler *Compiler) VisitVariableDeclaration(declaration *ast.VariableDeclaration) ast.Repr
- func (compiler *Compiler) VisitWhileStatement(_ *ast.WhileStatement) ast.Repr
- type Local
- type LocalActivation
- type LocalActivations
- func (a *LocalActivations) Current() *LocalActivation
- func (a *LocalActivations) CurrentOrNew() *LocalActivation
- func (a *LocalActivations) Depth() int
- func (a *LocalActivations) Find(name string) *Local
- func (a *LocalActivations) Pop()
- func (a *LocalActivations) Push(activation *LocalActivation)
- func (a *LocalActivations) PushNewWithCurrent()
- func (a *LocalActivations) PushNewWithParent(parent *LocalActivation) *LocalActivation
- func (a *LocalActivations) Set(name string, value *Local)
Constants ¶
const RuntimeModuleName = "crt"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Compiler ¶
func NewCompiler ¶
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) 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) 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) 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 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(memoryGauge common.MemoryGauge, 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) FunctionValues ¶ added in v0.24.0
func (a *LocalActivation) FunctionValues() map[string]*Local
FunctionValues returns all values in the current function activation.
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
}
LocalActivations 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 NewLocalActivations ¶ added in v0.24.0
func NewLocalActivations(memoryGauge common.MemoryGauge) *LocalActivations
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 exist, 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.