ir

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assign

type Assign struct {
	Names  []string // Left-hand side variable names
	Expr   string   // Right-hand side expression (pre-rendered)
	Walrus bool     // true for :=, false for =
}

Assign represents an assignment: names := expr or names = expr.

type Block

type Block struct {
	Nodes []Node
}

Block is an ordered sequence of IR nodes.

func (*Block) Add

func (b *Block) Add(n Node)

Add appends a node to the block.

func (*Block) AddAll

func (b *Block) AddAll(other *Block)

AddAll appends all nodes from another block.

type Comment added in v0.0.16

type Comment struct {
	Text string
}

Comment represents a Go comment line: // text

type ExprStmt added in v0.0.16

type ExprStmt struct {
	Expr string // Pre-rendered expression
}

ExprStmt represents a standalone expression statement (e.g., panic(...), continue, break).

type Goto

type Goto struct {
	Label string
}

Goto represents a goto statement: goto Label.

type IfErrCheck

type IfErrCheck struct {
	ErrVar string // The error variable to check
	Body   *Block // Statements inside the if block
}

IfErrCheck represents: if errVar != nil { body }

type Label

type Label struct {
	Name string
}

Label represents a label: LabelName:

type Node

type Node interface {
	// contains filtered or unexported methods
}

Node is the interface implemented by all IR nodes. IR nodes represent Go-level imperative operations after lowering high-level Kukicha constructs (pipes, onerr) into sequences of assignments, error checks, and control flow.

type RawStmt

type RawStmt struct {
	Code string
}

RawStmt is a pre-rendered Go statement (escape hatch). Used for constructs the lowerer doesn't handle yet.

type ReturnStmt added in v0.0.16

type ReturnStmt struct {
	Values []string // Pre-rendered return value expressions (empty for bare return)
}

ReturnStmt represents a return statement: return val1, val2, ...

type ScopedBlock

type ScopedBlock struct {
	Body *Block
}

ScopedBlock represents a bare { ... } block for variable scoping.

type VarDecl

type VarDecl struct {
	Name  string
	Type  string
	Value string // Empty if no initializer
}

VarDecl represents a variable declaration: var name type [= value].

Jump to

Keyboard shortcuts

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