ir

package
v1.0.0-preview.15 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinOp

type BinOp uint
const (
	BinOpUnknown BinOp = iota
	BinOpPlus
)

func (BinOp) String

func (i BinOp) String() string

type BinOpExpr

type BinOpExpr struct {
	Left  Expr
	Right Expr
	Op    BinOp
}

func (*BinOpExpr) Accept

func (e *BinOpExpr) Accept(v Visitor) Repr

type Block

type Block struct {
	Stmts []Stmt
}

func (*Block) Accept

func (s *Block) Accept(v Visitor) Repr

type Branch

type Branch struct {
	Index uint32
}

func (*Branch) Accept

func (s *Branch) Accept(v Visitor) Repr

type BranchIf

type BranchIf struct {
	Exp   Expr
	Index uint32
}

func (*BranchIf) Accept

func (s *BranchIf) Accept(v Visitor) Repr

type Call

type Call struct {
	Arguments     []Expr
	FunctionIndex uint32
}

func (*Call) Accept

func (e *Call) Accept(v Visitor) Repr

type Const

type Const struct {
	Constant Constant
}

func (*Const) Accept

func (e *Const) Accept(v Visitor) Repr

type ConstVisitor

type ConstVisitor interface {
	VisitInt(Int) Repr
	VisitString(String) Repr
}

type Constant

type Constant interface {
	Accept(Visitor) Repr
	// contains filtered or unexported methods
}

type CopyLocal

type CopyLocal struct {
	LocalIndex uint32
}

func (*CopyLocal) Accept

func (e *CopyLocal) Accept(v Visitor) Repr

type Drop

type Drop struct {
	Exp Expr
}

func (*Drop) Accept

func (s *Drop) Accept(v Visitor) Repr

type Expr

type Expr interface {
	Accept(Visitor) Repr
	// contains filtered or unexported methods
}

type ExprVisitor

type ExprVisitor interface {
	VisitConst(*Const) Repr
	VisitCopyLocal(*CopyLocal) Repr
	VisitMoveLocal(*MoveLocal) Repr
	VisitUnOpExpr(*UnOpExpr) Repr
	VisitBinOpExpr(*BinOpExpr) Repr
	VisitCall(*Call) Repr
}

type Func

type Func struct {
	Statement Stmt
	Name      string
	Type      FuncType
	Locals    []Local
}

func (*Func) Accept

func (f *Func) Accept(v Visitor) Repr

type FuncType

type FuncType struct {
	Params  []ValType
	Results []ValType
}

type If

type If struct {
	Test Expr
	Then Stmt
	Else Stmt
}

func (*If) Accept

func (s *If) Accept(v Visitor) Repr

type Int

type Int struct {
	Value []byte
}

func (Int) Accept

func (c Int) Accept(v Visitor) Repr

type Local

type Local struct {
	Type ValType
}

type Loop

type Loop struct {
	Stmts []Stmt
}

func (*Loop) Accept

func (s *Loop) Accept(v Visitor) Repr

type MoveLocal

type MoveLocal struct {
	LocalIndex uint32
}

func (*MoveLocal) Accept

func (e *MoveLocal) Accept(v Visitor) Repr

type Repr

type Repr any

type Return

type Return struct {
	Exp Expr
}

func (*Return) Accept

func (s *Return) Accept(v Visitor) Repr

type Sequence

type Sequence struct {
	Stmts []Stmt
}

func (*Sequence) Accept

func (s *Sequence) Accept(v Visitor) Repr

type Stmt

type Stmt interface {
	Accept(Visitor) Repr
	// contains filtered or unexported methods
}

type StmtVisitor

type StmtVisitor interface {
	VisitSequence(*Sequence) Repr
	VisitBlock(*Block) Repr
	VisitLoop(*Loop) Repr
	VisitIf(*If) Repr
	VisitBranch(*Branch) Repr
	VisitBranchIf(*BranchIf) Repr
	VisitStoreLocal(*StoreLocal) Repr
	VisitDrop(*Drop) Repr
	VisitReturn(*Return) Repr
}

type StoreLocal

type StoreLocal struct {
	Exp        Expr
	LocalIndex uint32
}

func (*StoreLocal) Accept

func (s *StoreLocal) Accept(v Visitor) Repr

type String added in v0.13.0

type String struct {
	Value string
}

func (String) Accept added in v0.13.0

func (c String) Accept(v Visitor) Repr

type UnOp

type UnOp uint
const (
	UnOpUnknown UnOp = iota
)

func (UnOp) String

func (i UnOp) String() string

type UnOpExpr

type UnOpExpr struct {
	Expr Expr
	Op   UnOp
}

func (*UnOpExpr) Accept

func (e *UnOpExpr) Accept(v Visitor) Repr

type ValType

type ValType uint
const (
	ValTypeUnknown ValType = iota
	ValTypeInt
	ValTypeString
)

func (ValType) String added in v0.12.6

func (i ValType) String() string

type Visitor

type Visitor interface {
	ConstVisitor
	StmtVisitor
	ExprVisitor
	VisitFunc(f *Func) Repr
}

Jump to

Keyboard shortcuts

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