compiler

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommonBuiltinTypeBoundFunctions = []BuiltinFunction{
	{
		Name: sema.GetTypeFunctionName,
		Type: sema.GetTypeFunctionType,
	},
	{
		Name: sema.IsInstanceFunctionName,
		Type: sema.IsInstanceFunctionType,
	},
}

Functions

func DefaultBuiltinGlobals

func DefaultBuiltinGlobals() *activations.Activation[GlobalImport]

Types

type BuiltinFunction

type BuiltinFunction struct {
	Name string
	Type *sema.FunctionType
}

type BuiltinGlobalsProvider

type BuiltinGlobalsProvider func(location common.Location) *activations.Activation[GlobalImport]

type ByteCodeGen

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

ByteCodeGen is a CodeGen implementation that emits bytecode

func (*ByteCodeGen) Emit

func (g *ByteCodeGen) Emit(instruction opcode.Instruction)

func (*ByteCodeGen) LastInstruction

func (g *ByteCodeGen) LastInstruction() opcode.Instruction

func (*ByteCodeGen) Offset

func (g *ByteCodeGen) Offset() int

func (*ByteCodeGen) PatchJump

func (g *ByteCodeGen) PatchJump(offset int, newTarget uint16)

func (*ByteCodeGen) SetTarget

func (g *ByteCodeGen) SetTarget(target *[]byte)

type CodeGen

type CodeGen[E any] interface {
	Offset() int
	SetTarget(code *[]E)
	Emit(instruction opcode.Instruction)
	PatchJump(offset int, newTarget uint16)
	LastInstruction() opcode.Instruction
}

type Compiler

type Compiler[E, T any] struct {
	Program              *ast.Program
	DesugaredElaboration *DesugaredElaboration
	Config               *Config

	Globals map[string]*Global
	// contains filtered or unexported fields
}

func NewBytecodeCompiler

func NewBytecodeCompiler(
	program *interpreter.Program,
	location common.Location,
	config *Config,
) *Compiler[byte, []byte]

func NewInstructionCompiler

func NewInstructionCompiler(
	program *interpreter.Program,
	location common.Location,
) *Compiler[opcode.Instruction, bbq.StaticType]

func NewInstructionCompilerWithConfig

func NewInstructionCompilerWithConfig(
	program *interpreter.Program,
	location common.Location,
	config *Config,
) *Compiler[opcode.Instruction, bbq.StaticType]

func (*Compiler[E, T]) Compile

func (c *Compiler[E, T]) Compile() *bbq.Program[E, T]

func (*Compiler[_, _]) VisitArrayExpression

func (c *Compiler[_, _]) VisitArrayExpression(array *ast.ArrayExpression) (_ struct{})

func (*Compiler[_, _]) VisitAssignmentStatement

func (c *Compiler[_, _]) VisitAssignmentStatement(statement *ast.AssignmentStatement) (_ struct{})

func (*Compiler[_, _]) VisitAttachExpression

func (c *Compiler[_, _]) VisitAttachExpression(_ *ast.AttachExpression) (_ struct{})

func (*Compiler[_, _]) VisitAttachmentDeclaration

func (c *Compiler[_, _]) VisitAttachmentDeclaration(_ *ast.AttachmentDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitBinaryExpression

func (c *Compiler[_, _]) VisitBinaryExpression(expression *ast.BinaryExpression) (_ struct{})

func (*Compiler[_, _]) VisitBoolExpression

func (c *Compiler[_, _]) VisitBoolExpression(expression *ast.BoolExpression) (_ struct{})

func (*Compiler[_, _]) VisitBreakStatement

func (c *Compiler[_, _]) VisitBreakStatement(_ *ast.BreakStatement) (_ struct{})

func (*Compiler[_, _]) VisitCastingExpression

func (c *Compiler[_, _]) VisitCastingExpression(expression *ast.CastingExpression) (_ struct{})

func (*Compiler[_, _]) VisitCompositeDeclaration

func (c *Compiler[_, _]) VisitCompositeDeclaration(declaration *ast.CompositeDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitConditionalExpression

func (c *Compiler[_, _]) VisitConditionalExpression(expression *ast.ConditionalExpression) (_ struct{})

func (*Compiler[_, _]) VisitContinueStatement

func (c *Compiler[_, _]) VisitContinueStatement(_ *ast.ContinueStatement) (_ struct{})

func (*Compiler[_, _]) VisitCreateExpression

func (c *Compiler[_, _]) VisitCreateExpression(expression *ast.CreateExpression) (_ struct{})

func (*Compiler[_, _]) VisitDestroyExpression

func (c *Compiler[_, _]) VisitDestroyExpression(expression *ast.DestroyExpression) (_ struct{})

func (*Compiler[_, _]) VisitDictionaryExpression

func (c *Compiler[_, _]) VisitDictionaryExpression(dictionary *ast.DictionaryExpression) (_ struct{})

func (*Compiler[_, _]) VisitEmitStatement

func (c *Compiler[_, _]) VisitEmitStatement(statement *ast.EmitStatement) (_ struct{})

func (*Compiler[_, _]) VisitEntitlementDeclaration

func (c *Compiler[_, _]) VisitEntitlementDeclaration(_ *ast.EntitlementDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitEntitlementMappingDeclaration

func (c *Compiler[_, _]) VisitEntitlementMappingDeclaration(_ *ast.EntitlementMappingDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitEnumCaseDeclaration

func (c *Compiler[_, _]) VisitEnumCaseDeclaration(_ *ast.EnumCaseDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitExpressionStatement

func (c *Compiler[_, _]) VisitExpressionStatement(statement *ast.ExpressionStatement) (_ struct{})

func (*Compiler[_, _]) VisitFieldDeclaration

func (c *Compiler[_, _]) VisitFieldDeclaration(_ *ast.FieldDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitFixedPointExpression

func (c *Compiler[_, _]) VisitFixedPointExpression(expression *ast.FixedPointExpression) (_ struct{})

func (*Compiler[_, _]) VisitForStatement

func (c *Compiler[_, _]) VisitForStatement(statement *ast.ForStatement) (_ struct{})

func (*Compiler[_, _]) VisitForceExpression

func (c *Compiler[_, _]) VisitForceExpression(expression *ast.ForceExpression) (_ struct{})

func (*Compiler[E, _]) VisitFunctionDeclaration

func (c *Compiler[E, _]) VisitFunctionDeclaration(declaration *ast.FunctionDeclaration, _ bool) (_ struct{})

func (*Compiler[_, _]) VisitFunctionExpression

func (c *Compiler[_, _]) VisitFunctionExpression(expression *ast.FunctionExpression) (_ struct{})

func (*Compiler[_, _]) VisitIdentifierExpression

func (c *Compiler[_, _]) VisitIdentifierExpression(expression *ast.IdentifierExpression) (_ struct{})

func (*Compiler[_, _]) VisitIfStatement

func (c *Compiler[_, _]) VisitIfStatement(statement *ast.IfStatement) (_ struct{})

func (*Compiler[_, _]) VisitImportDeclaration

func (c *Compiler[_, _]) VisitImportDeclaration(declaration *ast.ImportDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitIndexExpression

func (c *Compiler[_, _]) VisitIndexExpression(expression *ast.IndexExpression) (_ struct{})

func (*Compiler[_, _]) VisitIntegerExpression

func (c *Compiler[_, _]) VisitIntegerExpression(expression *ast.IntegerExpression) (_ struct{})

func (*Compiler[_, _]) VisitInterfaceDeclaration

func (c *Compiler[_, _]) VisitInterfaceDeclaration(declaration *ast.InterfaceDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitInvocationExpression

func (c *Compiler[_, _]) VisitInvocationExpression(expression *ast.InvocationExpression) (_ struct{})

func (*Compiler[_, _]) VisitMemberExpression

func (c *Compiler[_, _]) VisitMemberExpression(expression *ast.MemberExpression) (_ struct{})

func (*Compiler[_, _]) VisitNilExpression

func (c *Compiler[_, _]) VisitNilExpression(_ *ast.NilExpression) (_ struct{})

func (*Compiler[_, _]) VisitPathExpression

func (c *Compiler[_, _]) VisitPathExpression(expression *ast.PathExpression) (_ struct{})

func (*Compiler[_, _]) VisitPragmaDeclaration

func (c *Compiler[_, _]) VisitPragmaDeclaration(_ *ast.PragmaDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitReferenceExpression

func (c *Compiler[_, _]) VisitReferenceExpression(expression *ast.ReferenceExpression) (_ struct{})

func (*Compiler[_, _]) VisitRemoveStatement

func (c *Compiler[_, _]) VisitRemoveStatement(_ *ast.RemoveStatement) (_ struct{})

func (*Compiler[_, _]) VisitReturnStatement

func (c *Compiler[_, _]) VisitReturnStatement(statement *ast.ReturnStatement) (_ struct{})

func (*Compiler[_, _]) VisitSpecialFunctionDeclaration

func (c *Compiler[_, _]) VisitSpecialFunctionDeclaration(declaration *ast.SpecialFunctionDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitStringExpression

func (c *Compiler[_, _]) VisitStringExpression(expression *ast.StringExpression) (_ struct{})

func (*Compiler[_, _]) VisitStringTemplateExpression

func (c *Compiler[_, _]) VisitStringTemplateExpression(expression *ast.StringTemplateExpression) (_ struct{})

func (*Compiler[_, _]) VisitSwapStatement

func (c *Compiler[_, _]) VisitSwapStatement(statement *ast.SwapStatement) (_ struct{})

func (*Compiler[_, _]) VisitSwitchStatement

func (c *Compiler[_, _]) VisitSwitchStatement(statement *ast.SwitchStatement) (_ struct{})

func (*Compiler[_, _]) VisitTransactionDeclaration

func (c *Compiler[_, _]) VisitTransactionDeclaration(_ *ast.TransactionDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitUnaryExpression

func (c *Compiler[_, _]) VisitUnaryExpression(expression *ast.UnaryExpression) (_ struct{})

func (*Compiler[_, _]) VisitVariableDeclaration

func (c *Compiler[_, _]) VisitVariableDeclaration(declaration *ast.VariableDeclaration) (_ struct{})

func (*Compiler[_, _]) VisitVoidExpression

func (c *Compiler[_, _]) VisitVoidExpression(_ *ast.VoidExpression) (_ struct{})

func (*Compiler[_, _]) VisitWhileStatement

func (c *Compiler[_, _]) VisitWhileStatement(statement *ast.WhileStatement) (_ struct{})

type Config

type Config struct {
	MemoryGauge         common.MemoryGauge
	ImportHandler       commons.ImportHandler
	LocationHandler     commons.LocationHandler
	ElaborationResolver ElaborationResolver
	// BuiltinGlobalsProvider provides the built-in globals for a given location.
	// NOTE: all global imports must be for location nil!
	BuiltinGlobalsProvider BuiltinGlobalsProvider
}

type Constant

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

func NewConstant

func NewConstant(
	gauge common.MemoryGauge,
	index uint16,
	kind constant.Kind,
	data []byte,
) *Constant

type DecodedTypeGen

type DecodedTypeGen struct {
}

func (DecodedTypeGen) CompileType

func (d DecodedTypeGen) CompileType(staticType bbq.StaticType) bbq.StaticType

type Desugar

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

Desugar will rewrite the AST from high-level abstractions to a much lower-level abstractions, so the compiler and vm could work with a minimal set of language features.

func NewDesugar

func NewDesugar(
	memoryGauge common.MemoryGauge,
	compilerConfig *Config,
	program *ast.Program,
	elaboration *DesugaredElaboration,
	location common.Location,
) *Desugar

func (*Desugar) DesugarFunctionExpression

func (d *Desugar) DesugarFunctionExpression(expression *ast.FunctionExpression) *ast.FunctionExpression

func (*Desugar) DesugarInnerFunction

func (d *Desugar) DesugarInnerFunction(declaration *ast.FunctionDeclaration) *ast.FunctionDeclaration

func (*Desugar) Run

func (d *Desugar) Run() DesugaredProgram

Run desugars and rewrites the top-level declarations. It will not desugar/rewrite any statements or expressions.

func (*Desugar) VisitAttachmentDeclaration

func (d *Desugar) VisitAttachmentDeclaration(declaration *ast.AttachmentDeclaration) ast.Declaration

func (*Desugar) VisitCompositeDeclaration

func (d *Desugar) VisitCompositeDeclaration(declaration *ast.CompositeDeclaration) ast.Declaration

func (*Desugar) VisitEntitlementDeclaration

func (d *Desugar) VisitEntitlementDeclaration(declaration *ast.EntitlementDeclaration) ast.Declaration

func (*Desugar) VisitEntitlementMappingDeclaration

func (d *Desugar) VisitEntitlementMappingDeclaration(declaration *ast.EntitlementMappingDeclaration) ast.Declaration

func (*Desugar) VisitEnumCaseDeclaration

func (d *Desugar) VisitEnumCaseDeclaration(declaration *ast.EnumCaseDeclaration) ast.Declaration

func (*Desugar) VisitFieldDeclaration

func (d *Desugar) VisitFieldDeclaration(declaration *ast.FieldDeclaration) ast.Declaration

func (*Desugar) VisitFunctionDeclaration

func (d *Desugar) VisitFunctionDeclaration(declaration *ast.FunctionDeclaration, _ bool) ast.Declaration

func (*Desugar) VisitImportDeclaration

func (d *Desugar) VisitImportDeclaration(declaration *ast.ImportDeclaration) ast.Declaration

func (*Desugar) VisitInterfaceDeclaration

func (d *Desugar) VisitInterfaceDeclaration(declaration *ast.InterfaceDeclaration) ast.Declaration

func (*Desugar) VisitPragmaDeclaration

func (d *Desugar) VisitPragmaDeclaration(declaration *ast.PragmaDeclaration) ast.Declaration

func (*Desugar) VisitSpecialFunctionDeclaration

func (d *Desugar) VisitSpecialFunctionDeclaration(declaration *ast.SpecialFunctionDeclaration) ast.Declaration

func (*Desugar) VisitTransactionDeclaration

func (d *Desugar) VisitTransactionDeclaration(transaction *ast.TransactionDeclaration) ast.Declaration

func (*Desugar) VisitVariableDeclaration

func (d *Desugar) VisitVariableDeclaration(declaration *ast.VariableDeclaration) ast.Declaration

type DesugaredElaboration

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

func NewDesugaredElaboration

func NewDesugaredElaboration(elaboration *sema.Elaboration) *DesugaredElaboration

func (*DesugaredElaboration) AllImportDeclarationsResolvedLocations

func (e *DesugaredElaboration) AllImportDeclarationsResolvedLocations() map[*ast.ImportDeclaration][]sema.ResolvedLocation

func (*DesugaredElaboration) ArrayExpressionTypes

func (e *DesugaredElaboration) ArrayExpressionTypes(expression *ast.ArrayExpression) sema.ArrayExpressionTypes

func (*DesugaredElaboration) AssignmentStatementTypes

func (e *DesugaredElaboration) AssignmentStatementTypes(assignment *ast.AssignmentStatement) sema.AssignmentStatementTypes

func (*DesugaredElaboration) CastingExpressionTypes

func (e *DesugaredElaboration) CastingExpressionTypes(expression *ast.CastingExpression) sema.CastingExpressionTypes

func (*DesugaredElaboration) CompositeDeclarationType

func (e *DesugaredElaboration) CompositeDeclarationType(declaration ast.CompositeLikeDeclaration) *sema.CompositeType

func (*DesugaredElaboration) CompositeType

func (e *DesugaredElaboration) CompositeType(typeID common.TypeID) *sema.CompositeType

func (*DesugaredElaboration) DefaultDestroyDeclaration

func (e *DesugaredElaboration) DefaultDestroyDeclaration(declaration ast.Declaration) *ast.CompositeDeclaration

func (*DesugaredElaboration) DictionaryExpressionTypes

func (e *DesugaredElaboration) DictionaryExpressionTypes(expression *ast.DictionaryExpression) sema.DictionaryExpressionTypes

func (*DesugaredElaboration) EmitStatementEventType

func (e *DesugaredElaboration) EmitStatementEventType(statement *ast.EmitStatement) *sema.CompositeType

func (*DesugaredElaboration) EntitlementMapType

func (e *DesugaredElaboration) EntitlementMapType(typeID common.TypeID) *sema.EntitlementMapType

func (*DesugaredElaboration) EntitlementType

func (e *DesugaredElaboration) EntitlementType(typeID common.TypeID) *sema.EntitlementType

func (*DesugaredElaboration) EnumLookupFunctionType

func (e *DesugaredElaboration) EnumLookupFunctionType(enumType *sema.CompositeType) *sema.FunctionType

func (*DesugaredElaboration) FixedPointExpressionType

func (e *DesugaredElaboration) FixedPointExpressionType(expression *ast.FixedPointExpression) sema.Type

func (*DesugaredElaboration) ForStatementType

func (e *DesugaredElaboration) ForStatementType(statement *ast.ForStatement) (types sema.ForStatementTypes)

func (*DesugaredElaboration) FunctionDeclarationFunctionType

func (e *DesugaredElaboration) FunctionDeclarationFunctionType(declaration *ast.FunctionDeclaration) *sema.FunctionType

func (*DesugaredElaboration) FunctionExpressionFunctionType

func (e *DesugaredElaboration) FunctionExpressionFunctionType(expression *ast.FunctionExpression) *sema.FunctionType

func (*DesugaredElaboration) GetGlobalType

func (e *DesugaredElaboration) GetGlobalType(name string) (*sema.Variable, bool)

func (*DesugaredElaboration) IndexExpressionTypes

func (e *DesugaredElaboration) IndexExpressionTypes(expression *ast.IndexExpression) (types sema.IndexExpressionTypes, contains bool)

func (*DesugaredElaboration) IntegerExpressionType

func (e *DesugaredElaboration) IntegerExpressionType(expression *ast.IntegerExpression) sema.Type

func (*DesugaredElaboration) InterfaceDeclarationType

func (e *DesugaredElaboration) InterfaceDeclarationType(decl *ast.InterfaceDeclaration) *sema.InterfaceType

func (*DesugaredElaboration) InterfaceType

func (e *DesugaredElaboration) InterfaceType(typeID common.TypeID) *sema.InterfaceType

func (*DesugaredElaboration) InterfaceTypeDeclaration

func (e *DesugaredElaboration) InterfaceTypeDeclaration(interfaceType *sema.InterfaceType) *ast.InterfaceDeclaration

func (*DesugaredElaboration) InvocationExpressionTypes

func (e *DesugaredElaboration) InvocationExpressionTypes(
	expression *ast.InvocationExpression,
) sema.InvocationExpressionTypes

func (*DesugaredElaboration) IsInterfaceMethodStaticCall

func (e *DesugaredElaboration) IsInterfaceMethodStaticCall(invocation *ast.InvocationExpression) bool

func (*DesugaredElaboration) IsNestedResourceMoveExpression

func (e *DesugaredElaboration) IsNestedResourceMoveExpression(expression ast.Expression) bool

func (*DesugaredElaboration) MemberExpressionMemberAccessInfo

func (e *DesugaredElaboration) MemberExpressionMemberAccessInfo(expression *ast.MemberExpression) (memberInfo sema.MemberAccessInfo, ok bool)

func (*DesugaredElaboration) MoveExpressionTypes

func (e *DesugaredElaboration) MoveExpressionTypes(expression *ast.UnaryExpression) sema.Type

func (*DesugaredElaboration) OriginalElaboration

func (e *DesugaredElaboration) OriginalElaboration() *sema.Elaboration

OriginalElaboration returns the underlying elaboration. IMPORTANT: Only use the original elaboration for type-checking use-cases. It is safe to use in type-checker, since the type checker doesn't rely on extra information added by the desugar phase. Never use it in the compiler or desugar, as it may not include the type information added during the desugar phase.

func (*DesugaredElaboration) PostConditionsRewrite

func (e *DesugaredElaboration) PostConditionsRewrite(conditions *ast.Conditions) sema.PostConditionsRewrite

func (*DesugaredElaboration) ReferenceExpressionBorrowType

func (e *DesugaredElaboration) ReferenceExpressionBorrowType(expression *ast.ReferenceExpression) sema.Type

func (*DesugaredElaboration) ResultVariableType

func (e *DesugaredElaboration) ResultVariableType(enclosingBlock ast.Element) (typ sema.Type, exist bool)

func (*DesugaredElaboration) ReturnStatementTypes

func (e *DesugaredElaboration) ReturnStatementTypes(statement *ast.ReturnStatement) sema.ReturnStatementTypes

func (*DesugaredElaboration) SetArrayExpressionTypes

func (e *DesugaredElaboration) SetArrayExpressionTypes(expression *ast.ArrayExpression, types sema.ArrayExpressionTypes)

func (*DesugaredElaboration) SetAssignmentStatementTypes

func (e *DesugaredElaboration) SetAssignmentStatementTypes(
	assignment *ast.AssignmentStatement,
	types sema.AssignmentStatementTypes,
)

func (*DesugaredElaboration) SetCompositeDeclarationType

func (e *DesugaredElaboration) SetCompositeDeclarationType(
	declaration ast.CompositeLikeDeclaration,
	compositeType *sema.CompositeType,
)

func (*DesugaredElaboration) SetCompositeType

func (e *DesugaredElaboration) SetCompositeType(typeID common.TypeID, compositeType *sema.CompositeType)

func (*DesugaredElaboration) SetEmitStatementEventType

func (e *DesugaredElaboration) SetEmitStatementEventType(statement *ast.EmitStatement, compositeType *sema.CompositeType)

func (*DesugaredElaboration) SetFunctionDeclarationFunctionType

func (e *DesugaredElaboration) SetFunctionDeclarationFunctionType(
	declaration *ast.FunctionDeclaration,
	functionType *sema.FunctionType,
)

func (*DesugaredElaboration) SetFunctionExpressionFunctionType

func (e *DesugaredElaboration) SetFunctionExpressionFunctionType(
	expression *ast.FunctionExpression,
	functionType *sema.FunctionType,
)

func (*DesugaredElaboration) SetIntegerExpressionType

func (e *DesugaredElaboration) SetIntegerExpressionType(expression *ast.IntegerExpression, valueType sema.Type)

func (*DesugaredElaboration) SetInterfaceDeclarationType

func (e *DesugaredElaboration) SetInterfaceDeclarationType(decl *ast.InterfaceDeclaration, interfaceType *sema.InterfaceType)

func (*DesugaredElaboration) SetInterfaceMethodStaticCall

func (e *DesugaredElaboration) SetInterfaceMethodStaticCall(invocation *ast.InvocationExpression)

func (*DesugaredElaboration) SetInvocationExpressionTypes

func (e *DesugaredElaboration) SetInvocationExpressionTypes(
	expression *ast.InvocationExpression,
	types sema.InvocationExpressionTypes,
)

func (*DesugaredElaboration) SetMemberExpressionMemberAccessInfo

func (e *DesugaredElaboration) SetMemberExpressionMemberAccessInfo(expression *ast.MemberExpression, memberAccessInfo sema.MemberAccessInfo)

func (*DesugaredElaboration) SetReferenceExpressionBorrowType

func (e *DesugaredElaboration) SetReferenceExpressionBorrowType(expression *ast.ReferenceExpression, ty sema.Type)

func (*DesugaredElaboration) SetResultVariableType

func (e *DesugaredElaboration) SetResultVariableType(declaration ast.Element, typ sema.Type)

func (*DesugaredElaboration) SetReturnStatementTypes

func (e *DesugaredElaboration) SetReturnStatementTypes(statement *ast.ReturnStatement, types sema.ReturnStatementTypes)

func (*DesugaredElaboration) SetVariableDeclarationTypes

func (e *DesugaredElaboration) SetVariableDeclarationTypes(
	declaration *ast.VariableDeclaration,
	types sema.VariableDeclarationTypes,
)

func (*DesugaredElaboration) StringExpressionType

func (e *DesugaredElaboration) StringExpressionType(expression *ast.StringExpression) sema.Type

func (*DesugaredElaboration) SwapStatementTypes

func (e *DesugaredElaboration) SwapStatementTypes(statement *ast.SwapStatement) sema.SwapStatementTypes

func (*DesugaredElaboration) TransactionDeclarationType

func (e *DesugaredElaboration) TransactionDeclarationType(declaration *ast.TransactionDeclaration) *sema.TransactionType

func (*DesugaredElaboration) VariableDeclarationTypes

func (e *DesugaredElaboration) VariableDeclarationTypes(declaration *ast.VariableDeclaration) sema.VariableDeclarationTypes

type DesugaredProgram

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

type ElaborationResolver

type ElaborationResolver func(location common.Location) (*DesugaredElaboration, error)

type EncodedTypeGen

type EncodedTypeGen struct {
}

func (EncodedTypeGen) CompileType

func (d EncodedTypeGen) CompileType(staticType bbq.StaticType) []byte

type Global

type Global struct {
	Name     string
	Location common.Location
	Index    uint16
}

func NewGlobal

func NewGlobal(
	memoryGauge common.MemoryGauge,
	name string,
	location common.Location,
	index uint16,
) *Global

type GlobalImport

type GlobalImport struct {
	Location common.Location
	Name     string
}

type InstructionCodeGen

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

InstructionCodeGen is a CodeGen implementation that emits opcode.Instruction

func (*InstructionCodeGen) Emit

func (g *InstructionCodeGen) Emit(instruction opcode.Instruction)

func (*InstructionCodeGen) LastInstruction

func (g *InstructionCodeGen) LastInstruction() opcode.Instruction

func (*InstructionCodeGen) Offset

func (g *InstructionCodeGen) Offset() int

func (*InstructionCodeGen) PatchJump

func (g *InstructionCodeGen) PatchJump(offset int, newTarget uint16)

func (*InstructionCodeGen) SetTarget

func (g *InstructionCodeGen) SetTarget(target *[]opcode.Instruction)

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

type TypeGen

type TypeGen[T any] interface {
	CompileType(staticType bbq.StaticType) T
}

Jump to

Keyboard shortcuts

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