base

package
v1.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

README

This directory contains templates for use by irgen. They are written in the irgen template language.

  • base.go: low-level API for allocating and accessing IR nodes.
  • sexpr.go: code to print nodes using S-expression syntax

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSExprInt64

func FormatSExprInt64(buf *bytes.Buffer, x int64)

func FormatSExprTypName

func FormatSExprTypName(buf *bytes.Buffer, x Type)

FormatSExprTypName is a stub for Sexpr formatters for primitive types.

Types

type Allocator

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

Allocator allocates nodes in batches. Construct Allocators with NewAllocator and pass them by value.

func NewAllocator

func NewAllocator() Allocator

NewAllocator constructs a new Allocator.

type Enum

type Enum enum

Enum is an enumeration type.

const (
	// @for item
	EnumName Enum = 't'
)

Enum constants.

func (Enum) FormatSExpr

func (x Enum) FormatSExpr(buf *bytes.Buffer)

func (Enum) String

func (x Enum) String() string

type SexprFormatter

type SexprFormatter interface {
	FormatSExpr(buf *bytes.Buffer)
}

type Struct

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

Struct is the type of a reference to an immutable record.

func (Struct) FormatSExpr

func (x Struct) FormatSExpr(buf *bytes.Buffer)

func (Struct) Name

func (x Struct) Name() Type

Name returns the Name field.

func (Struct) V

func (x Struct) V() StructValue

V unpacks a reference into a value.

type StructValue

type StructValue struct {
	// @for item
	Name Type // 't'

}

StructValue is the logical type of a record. Immutable records are stored in nodes.

func (StructValue) R

func (x StructValue) R(a Allocator) Struct

R constructs a reference to an immutable record.

func (StructValue) WithName

func (x StructValue) WithName(y Type) StructValue

WithName constructs a new value where the value of Name has been replaced by the argument.

type Sum

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

Sum is the type of a tagged union of records.

func (Sum) FormatSExpr

func (x Sum) FormatSExpr(buf *bytes.Buffer)

func (Sum) MustBeType

func (x Sum) MustBeType() Type

MustBeType performs a downcast. If the downcast fails, panic.

func (Sum) Tag

func (x Sum) Tag() SumTag

Tag returns the tag.

func (Sum) Type

func (x Sum) Type() (Type, bool)

Type performs a downcast. If the downcast fails, return false.

type SumTag

type SumTag enum

SumTag is the tag type.

const (
	// @for item
	SumType SumTag = 't'
)

SumTag constants.

func (SumTag) String

func (x SumTag) String() string

type Type

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

Type is a mock struct type.

func (Type) FormatSExpr

func (t Type) FormatSExpr(buf *bytes.Buffer)

FormatSExpr implements the SexprFormatter interface.

func (Type) Sum

func (x Type) Sum() Sum

Sum performs an upcast.

Jump to

Keyboard shortcuts

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