ast

package
v1.2.23 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile added in v1.2.21

func Compile(prog Program, config codegen.Config) (vm.Program[vm.Uint], []source.SyntaxError)

Compile attempts to compile a given high-level program into a low-level machine which can be used (for example) to execute this program with some given inputs.

Types

type Environment

type Environment interface {
	data.ResolvedEnvironment
	// ConstOf resolves an external identifier as a constant expression.
	ConstOf(symbol.Resolved) expr.Resolved
}

Environment provides access to information about the enclosing program.

func NewEnvironment

func NewEnvironment(decls ...decl.Resolved) Environment

NewEnvironment constructs a new typing environment which wraps a "mapper" function which maps type indices to types.

type Program

type Program struct {
	RawProgram[symbol.Resolved]
	// contains filtered or unexported fields
}

Program represents a program whose declarations contain only resolved external identifiers. As such, it should not be possible that any declarations contained within refer to unknown (or otherwise incorrect) external components.

func NewProgram

func NewProgram(components []decl.Resolved, srcmaps source.Maps[any]) Program

NewProgram constructs a new program using a given level of instruction.

func (*Program) DecodeInputsOutputs

func (p *Program) DecodeInputsOutputs(input map[string][]byte) (inputs, outputs map[string][]vm.Uint, errs []error)

DecodeInputsOutputs configures a given set of input / output bytes appropriately for the boot program, whilst separating inputs from outputs. If there are unknown or conflicting inputs / outputs, then errors are returned.

func (*Program) EncodeInputsOutputs

func (p *Program) EncodeInputsOutputs(values map[string][]vm.Uint) (map[string][]byte, []error)

EncodeInputsOutputs encodes a given set of input / output word values back into raw bytes, producing the inverse of DecodeInputsOutputs. If there are unknown or conflicting entries, then errors are returned.

func (*Program) Environment

func (p *Program) Environment() Environment

Environment creates a fresh environment for this program

type RawProgram

type RawProgram[S any] struct {
	// contains filtered or unexported fields
}

RawProgram encapsulates one of more functions together, such that one may call another, etc. Furthermore, it provides an interface between assembly components and the notion of a Schema.

func (*RawProgram[S]) Component

func (p *RawProgram[S]) Component(id uint) decl.Declaration[S]

Component returns the ith entity in this program.

func (*RawProgram[S]) Components

func (p *RawProgram[S]) Components() []decl.Declaration[S]

Components returns all functions making up this program.

Directories

Path Synopsis
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

Jump to

Keyboard shortcuts

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