bootstrapsnapshot

package
v0.3.47 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package bootstrapsnapshot serializes deliberately small, data-only subsets of the checked TypeRB IR for temporary compiler bootstrapping. It exposes no compiler object across the process boundary and is not a stable protocol.

Index

Constants

View Source
const (
	Format   = "type-rb-bootstrap-snapshot"
	Version2 = 2
	Version3 = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryInstruction

type BinaryInstruction struct {
	Op       string `json:"op"`
	Result   string `json:"result"`
	Operator string `json:"operator"`
	Left     string `json:"left"`
	Right    string `json:"right"`
	Origin   Origin `json:"origin"`
}

type Block

type Block struct {
	ID           string      `json:"id"`
	Parameters   []Parameter `json:"parameters"`
	Origin       Origin      `json:"origin"`
	Instructions []any       `json:"instructions"`
	Terminator   any         `json:"terminator"`
}

type BooleanLiteral

type BooleanLiteral struct {
	Op     string `json:"op"`
	Result string `json:"result"`
	Value  bool   `json:"value"`
	Origin Origin `json:"origin"`
}

type BooleanNot

type BooleanNot struct {
	Op     string `json:"op"`
	Result string `json:"result"`
	Value  string `json:"value"`
	Origin Origin `json:"origin"`
}

type Branch

type Branch struct {
	Op             string   `json:"op"`
	Condition      string   `json:"condition"`
	WhenTrue       string   `json:"whenTrue"`
	TrueArguments  []string `json:"trueArguments"`
	WhenFalse      string   `json:"whenFalse"`
	FalseArguments []string `json:"falseArguments"`
	Origin         Origin   `json:"origin"`
}

type Call

type Call struct {
	Op        string   `json:"op"`
	Result    *string  `json:"result"`
	Function  string   `json:"function"`
	Arguments []string `json:"arguments"`
	Origin    Origin   `json:"origin"`
}

type Field

type Field struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type FloatLiteral

type FloatLiteral struct {
	Op     string  `json:"op"`
	Result string  `json:"result"`
	Value  float64 `json:"value"`
	Origin Origin  `json:"origin"`
}

type Function

type Function struct {
	ID         string      `json:"id"`
	Name       string      `json:"name"`
	Parameters []Parameter `json:"parameters"`
	Result     string      `json:"result"`
	Entry      string      `json:"entry"`
	Origin     Origin      `json:"origin"`
	Blocks     []Block     `json:"blocks"`
}

type IntegerLiteral

type IntegerLiteral struct {
	Op     string `json:"op"`
	Result string `json:"result"`
	Value  int64  `json:"value"`
	Origin Origin `json:"origin"`
}

type Jump

type Jump struct {
	Op        string   `json:"op"`
	Target    string   `json:"target"`
	Arguments []string `json:"arguments"`
	Origin    Origin   `json:"origin"`
}

type Origin

type Origin struct {
	Source      string `json:"source"`
	StartLine   int    `json:"startLine"`
	StartColumn int    `json:"startColumn"`
	EndLine     int    `json:"endLine"`
	EndColumn   int    `json:"endColumn"`
}

type Parameter

type Parameter struct {
	ID     string `json:"id"`
	Type   string `json:"type"`
	Origin Origin `json:"origin"`
}

type RecordConstruct

type RecordConstruct struct {
	Op        string   `json:"op"`
	Result    string   `json:"result"`
	Type      string   `json:"type"`
	Arguments []string `json:"arguments"`
	Origin    Origin   `json:"origin"`
}

type RecordProject

type RecordProject struct {
	Op     string `json:"op"`
	Result string `json:"result"`
	Type   string `json:"type"`
	Record string `json:"record"`
	Field  string `json:"field"`
	Origin Origin `json:"origin"`
}

type Return

type Return struct {
	Op     string  `json:"op"`
	Value  *string `json:"value"`
	Origin Origin  `json:"origin"`
}

type SnapshotV2

type SnapshotV2 struct {
	Format        string     `json:"format"`
	Version       int        `json:"version"`
	Module        string     `json:"module"`
	EntryFunction string     `json:"entryFunction"`
	Sources       []Source   `json:"sources"`
	Functions     []Function `json:"functions"`
}

func BuildV2

func BuildV2(artifacts []*compiler.Artifact, sourceRoot string) (SnapshotV2, error)

BuildV2 encodes the scalar-only version 2 bootstrap snapshot.

type SnapshotV3

type SnapshotV3 struct {
	Format        string           `json:"format"`
	Version       int              `json:"version"`
	Module        string           `json:"module"`
	EntryFunction string           `json:"entryFunction"`
	Sources       []Source         `json:"sources"`
	Types         []TypeDefinition `json:"types"`
	Functions     []Function       `json:"functions"`
}

func BuildV3

func BuildV3(artifacts []*compiler.Artifact, sourceRoot string) (SnapshotV3, error)

BuildV3 encodes the aggregate-capable version 3 bootstrap snapshot.

type Source

type Source struct {
	ID   string `json:"id"`
	Path string `json:"path"`
}

type TypeDefinition

type TypeDefinition struct {
	Kind     string     `json:"kind"`
	ID       string     `json:"id"`
	Fields   *[]Field   `json:"fields,omitempty"`
	Variants *[]Variant `json:"variants,omitempty"`
}

type UnsupportedError

type UnsupportedError struct {
	Path    string
	Span    token.Span
	Feature string
	Version int
}

func (*UnsupportedError) Error

func (e *UnsupportedError) Error() string

type Variant

type Variant struct {
	Name   string  `json:"name"`
	Fields []Field `json:"fields"`
}

type VariantConstruct

type VariantConstruct struct {
	Op        string   `json:"op"`
	Result    string   `json:"result"`
	Type      string   `json:"type"`
	Variant   string   `json:"variant"`
	Arguments []string `json:"arguments"`
	Origin    Origin   `json:"origin"`
}

type VariantProject

type VariantProject struct {
	Op      string `json:"op"`
	Result  string `json:"result"`
	Type    string `json:"type"`
	Value   string `json:"value"`
	Variant string `json:"variant"`
	Field   string `json:"field"`
	Origin  Origin `json:"origin"`
}

type VariantTest

type VariantTest struct {
	Op      string `json:"op"`
	Result  string `json:"result"`
	Type    string `json:"type"`
	Value   string `json:"value"`
	Variant string `json:"variant"`
	Origin  Origin `json:"origin"`
}

type WriteStatic

type WriteStatic struct {
	Op     string `json:"op"`
	Value  string `json:"value"`
	Origin Origin `json:"origin"`
}

Jump to

Keyboard shortcuts

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