rtg

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileProgram

func CompileProgram(src string) (*ir.Program, error)

CompileProgram parses src and lowers it into an ir.Program. The accepted language is intentionally small; unsupported constructs return friendly errors rather than attempting partial lowering.

func CompileProgramWithOptions

func CompileProgramWithOptions(src string, opts CompileOptions) (*ir.Program, error)

CompileProgramWithOptions parses src and lowers it into an ir.Program with the specified compilation options.

func FormatErrors

func FormatErrors(errs []error) string

FormatErrors joins multiple errors when tests want deterministic output.

Types

type CompileOptions

type CompileOptions struct {
	// GOARCH is the target architecture ("amd64" or "arm64").
	// Used to resolve runtime.GOARCH comparisons at compile time.
	GOARCH string

	// Flags holds compile-time flags for conditional compilation.
	// Used with runtime.Ifdef("flag") to include/exclude code at compile time.
	// Undefined flags are treated as false.
	Flags map[string]bool

	// Config holds compile-time configuration values.
	// Used with runtime.Config("key") to inject values at compile time.
	// Supported types: string, int64, []string
	Config map[string]any
}

CompileOptions specifies options for RTG compilation.

type Compiler

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

Compiler holds the state for a single source-to-IR lowering.

type Type

type Type struct {
	Kind       TypeKind
	BufferSize int64 // Size in bytes for TypeBuffer
}

func (Type) String

func (t Type) String() string

type TypeKind

type TypeKind int

TypeKind enumerates the minimal scalar types supported by the rtg front-end.

const (
	TypeInvalid TypeKind = iota
	TypeI64
	TypeI32
	TypeI16
	TypeI8
	TypeBool
	TypeUintptr
	TypeString
	TypeLabel
	TypeBuffer // Stack-allocated byte buffer
)

Directories

Path Synopsis
Package runtime provides stub declarations for the RTG runtime.
Package runtime provides stub declarations for the RTG runtime.

Jump to

Keyboard shortcuts

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