Documentation
¶
Index ¶
- Constants
- type AllocGroup
- type AllocNode
- type ArrayTypeNode
- type AssignNode
- type BreakNode
- type CallNode
- type ConditionNode
- type ConstantNode
- type ContinueNode
- type DataType
- type DeVariadicSliceNode
- type DeclarePackageNode
- type DecrementNode
- type DefineFuncNode
- type DefineTypeNode
- type DereferenceNode
- type ExternNode
- type FileNode
- type ForNode
- type FuncTypeNode
- type GetReferenceNode
- type GroupNode
- type ImportNode
- type IncrementNode
- type InitializeArrayNode
- type InitializeSliceNode
- type InitializeStringWithSliceNode
- type InitializeStructNode
- type InterfaceMethod
- type InterfaceTypeNode
- type LoadArrayElement
- type MultiNameNode
- type NameNode
- type NegateNode
- type Node
- type Operator
- type OperatorNode
- type PackageNode
- type PointerTypeNode
- type PragmaNode
- type RangeNode
- type ReturnNode
- type SingleTypeNode
- type SliceArrayNode
- type SliceTypeNode
- type StructLoadElementNode
- type StructTypeNode
- type SubNode
- type SwitchCaseNode
- type SwitchNode
- type TypeCastInterfaceNode
- type TypeCastNode
- type TypeNode
- type VersionScheme
- type Visitor
Constants ¶
const ( OP_ADD Operator = "+" OP_SUB = "-" OP_DIV = "/" OP_MUL = "*" OP_REMAINDER = "%" OP_BIT_AND = "&" OP_BIT_OR = "|" OP_BIT_XOR = "^" OP_BIT_CLEAR = "&^" // AND NOT OP_LEFT_SHIFT = "<<" OP_RIGHT_SHIFT = ">>" OP_GT = ">" OP_GTEQ = ">=" OP_LT = "<" OP_LTEQ = "<=" OP_EQ = "==" OP_NEQ = "!=" OP_LOGICAL_AND = "&&" OP_LOGICAL_OR = "||" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllocGroup ¶
type AllocGroup struct { Allocs []*AllocNode // contains filtered or unexported fields }
func (AllocGroup) String ¶
func (an AllocGroup) String() string
type AllocNode ¶
type AllocNode struct { Escapes bool Name []string Val []Node Type TypeNode // Is set when allocating on the format "var ident int" and "var ident, ident int = expr, expr" IsConst bool // Is true when in a const expression. // contains filtered or unexported fields }
AllocNode creates a new variable Name with the value Val
type ArrayTypeNode ¶
type ArrayTypeNode struct { SourceName string ItemType TypeNode Len int64 IsVariadic bool // contains filtered or unexported fields }
ArrayTypeNode refers to an array
func (ArrayTypeNode) GetName ¶
func (atn ArrayTypeNode) GetName() string
func (ArrayTypeNode) SetName ¶
func (atn ArrayTypeNode) SetName(name string)
func (ArrayTypeNode) String ¶
func (atn ArrayTypeNode) String() string
func (ArrayTypeNode) Type ¶
func (atn ArrayTypeNode) Type() string
func (ArrayTypeNode) Variadic ¶
func (atn ArrayTypeNode) Variadic() bool
type AssignNode ¶
AssignNode assign Val to Target (or Name)
func (AssignNode) String ¶
func (an AssignNode) String() string
type BreakNode ¶
type BreakNode struct {
// contains filtered or unexported fields
}
BreakNode breaks out of the current for loop
type ConditionNode ¶
type ConditionNode struct { Cond *OperatorNode True []Node False []Node // contains filtered or unexported fields }
ConditionNode creates a new if condition False is optional
func (ConditionNode) String ¶
func (ConditionNode) String() string
type ConstantNode ¶
type ConstantNode struct { Type DataType TargetType TypeNode Value int64 ValueStr string // contains filtered or unexported fields }
ConstantNode is a raw string or number
func (ConstantNode) String ¶
func (cn ConstantNode) String() string
type ContinueNode ¶
type ContinueNode struct {
// contains filtered or unexported fields
}
ContinueNode skips the current iteration of the current for loop
func (ContinueNode) String ¶
func (n ContinueNode) String() string
type DeVariadicSliceNode ¶
type DeVariadicSliceNode struct { Item Node // contains filtered or unexported fields }
func (DeVariadicSliceNode) String ¶
func (i DeVariadicSliceNode) String() string
type DeclarePackageNode ¶
type DeclarePackageNode struct { PackageName string // contains filtered or unexported fields }
DeclarePackageNode declares the package that we're in
func (DeclarePackageNode) String ¶
func (d DeclarePackageNode) String() string
type DecrementNode ¶
type DecrementNode struct { Item Node // contains filtered or unexported fields }
func (DecrementNode) String ¶
func (i DecrementNode) String() string
type DefineFuncNode ¶
type DefineFuncNode struct { Name string IsNamed bool IsMethod bool IsExtern bool MethodOnType *SingleTypeNode IsPointerReceiver bool InstanceName string Arguments []*NameNode ReturnValues []*NameNode Body []Node // contains filtered or unexported fields }
DefineFuncNode creates a new named function
func (DefineFuncNode) String ¶
func (dfn DefineFuncNode) String() string
type DefineTypeNode ¶
DefineTypeNode creates a new named type
func (DefineTypeNode) String ¶
func (dtn DefineTypeNode) String() string
type DereferenceNode ¶
type DereferenceNode struct { Item Node // contains filtered or unexported fields }
func (DereferenceNode) String ¶
func (dn DereferenceNode) String() string
type ExternNode ¶ added in v0.2.0
type ExternNode struct { FuncNodes []*DefineFuncNode // contains filtered or unexported fields }
func (ExternNode) String ¶ added in v0.2.0
func (en ExternNode) String() string
type FileNode ¶
type FileNode struct { Instructions []Node // contains filtered or unexported fields }
FileNode is a list of other nodes Indicates the root of one source file
type ForNode ¶
type ForNode struct { BeforeLoop Node Condition *OperatorNode AfterIteration Node Block []Node IsThreeTypeFor bool // contains filtered or unexported fields }
ForNode creates a new for-loop
type FuncTypeNode ¶
type FuncTypeNode struct { ArgTypes []TypeNode RetTypes []TypeNode SourceName string IsVariadic bool // contains filtered or unexported fields }
func (FuncTypeNode) GetName ¶
func (ftn FuncTypeNode) GetName() string
func (FuncTypeNode) SetName ¶
func (ftn FuncTypeNode) SetName(name string)
func (FuncTypeNode) String ¶
func (ftn FuncTypeNode) String() string
func (FuncTypeNode) Type ¶
func (ftn FuncTypeNode) Type() string
func (FuncTypeNode) Variadic ¶
func (ftn FuncTypeNode) Variadic() bool
type GetReferenceNode ¶
type GetReferenceNode struct { Item Node // contains filtered or unexported fields }
func (GetReferenceNode) String ¶
func (grn GetReferenceNode) String() string
type ImportNode ¶
type ImportNode struct { PackagePaths []string // contains filtered or unexported fields }
func (ImportNode) String ¶
func (in ImportNode) String() string
type IncrementNode ¶
type IncrementNode struct { Item Node // contains filtered or unexported fields }
func (IncrementNode) String ¶
func (i IncrementNode) String() string
type InitializeArrayNode ¶
type InitializeArrayNode struct { Type TypeNode Size int Items []Node // contains filtered or unexported fields }
func (InitializeArrayNode) String ¶
func (i InitializeArrayNode) String() string
type InitializeSliceNode ¶
type InitializeSliceNode struct { Type TypeNode Len Node Cap Node Items []Node // contains filtered or unexported fields }
func (InitializeSliceNode) String ¶
func (i InitializeSliceNode) String() string
type InitializeStringWithSliceNode ¶ added in v0.2.0
type InitializeStringWithSliceNode struct { Items []Node // contains filtered or unexported fields }
func (*InitializeStringWithSliceNode) Node ¶ added in v0.2.0
func (n *InitializeStringWithSliceNode) Node()
func (InitializeStringWithSliceNode) String ¶ added in v0.2.0
func (i InitializeStringWithSliceNode) String() string
type InitializeStructNode ¶
type InitializeStructNode struct { Type TypeNode Items map[string]Node // contains filtered or unexported fields }
func (InitializeStructNode) String ¶
func (i InitializeStructNode) String() string
type InterfaceMethod ¶
type InterfaceTypeNode ¶
type InterfaceTypeNode struct { SourceName string Methods map[string]InterfaceMethod IsVariadic bool // contains filtered or unexported fields }
func (InterfaceTypeNode) GetName ¶
func (itn InterfaceTypeNode) GetName() string
func (InterfaceTypeNode) SetName ¶
func (itn InterfaceTypeNode) SetName(name string)
func (InterfaceTypeNode) String ¶
func (itn InterfaceTypeNode) String() string
func (InterfaceTypeNode) Type ¶
func (itn InterfaceTypeNode) Type() string
func (InterfaceTypeNode) Variadic ¶
func (itn InterfaceTypeNode) Variadic() bool
type LoadArrayElement ¶
LoadArrayElement loads a single element from an array On the form arr[1]
func (LoadArrayElement) String ¶
func (l LoadArrayElement) String() string
type MultiNameNode ¶
type MultiNameNode struct { Names []*NameNode // contains filtered or unexported fields }
func (MultiNameNode) String ¶
func (n MultiNameNode) String() string
type NameNode ¶
type NameNode struct { Package string Name string Type TypeNode // contains filtered or unexported fields }
NameNode retreives a named variable
type NegateNode ¶
type NegateNode struct { Item Node // contains filtered or unexported fields }
func (NegateNode) String ¶
func (nn NegateNode) String() string
type Node ¶
type Node interface { Node() String() string }
Node is the base node. A node consists of something that the compiler or language can do
type OperatorNode ¶
type OperatorNode struct { Operator Operator Left Node Right Node // contains filtered or unexported fields }
OperatorNode is mathematical operations and comparisons
func (OperatorNode) String ¶
func (on OperatorNode) String() string
type PackageNode ¶
type PointerTypeNode ¶
type PointerTypeNode struct { SourceName string IsVariadic bool ValueType TypeNode // contains filtered or unexported fields }
func (PointerTypeNode) GetName ¶
func (ptn PointerTypeNode) GetName() string
func (PointerTypeNode) SetName ¶
func (ptn PointerTypeNode) SetName(name string)
func (PointerTypeNode) String ¶
func (ptn PointerTypeNode) String() string
func (PointerTypeNode) Type ¶
func (ptn PointerTypeNode) Type() string
func (PointerTypeNode) Variadic ¶
func (ptn PointerTypeNode) Variadic() bool
type PragmaNode ¶
type PragmaNode struct { Version VersionScheme // contains filtered or unexported fields }
PragmaNode implements the Node interface, to tell compiler how to compile
func (PragmaNode) String ¶
func (p PragmaNode) String() string
type ReturnNode ¶
type ReturnNode struct { Vals []Node // contains filtered or unexported fields }
ReturnNode returns Val from within the current function
func (ReturnNode) String ¶
func (rn ReturnNode) String() string
type SingleTypeNode ¶
type SingleTypeNode struct { PackageName string SourceName string TypeName string IsVariadic bool // contains filtered or unexported fields }
SingleTypeNode refers to an existing type. Such as "string".
func (SingleTypeNode) GetName ¶
func (stn SingleTypeNode) GetName() string
func (SingleTypeNode) SetName ¶
func (stn SingleTypeNode) SetName(name string)
func (SingleTypeNode) String ¶
func (stn SingleTypeNode) String() string
func (SingleTypeNode) Type ¶
func (stn SingleTypeNode) Type() string
func (SingleTypeNode) Variadic ¶
func (stn SingleTypeNode) Variadic() bool
type SliceArrayNode ¶
type SliceArrayNode struct { Val Node Start Node HasEnd bool End Node // contains filtered or unexported fields }
SliceArrayNode slices an array or string Can be on the forms arr[1], arr[1:], or arr[1:3]
func (SliceArrayNode) String ¶
func (san SliceArrayNode) String() string
type SliceTypeNode ¶
type SliceTypeNode struct { SourceName string ItemType TypeNode IsVariadic bool // contains filtered or unexported fields }
func (SliceTypeNode) GetName ¶
func (stn SliceTypeNode) GetName() string
func (SliceTypeNode) SetName ¶
func (stn SliceTypeNode) SetName(name string)
func (SliceTypeNode) String ¶
func (stn SliceTypeNode) String() string
func (SliceTypeNode) Type ¶
func (stn SliceTypeNode) Type() string
func (SliceTypeNode) Variadic ¶
func (stn SliceTypeNode) Variadic() bool
type StructLoadElementNode ¶
type StructLoadElementNode struct { Struct Node ElementName string // contains filtered or unexported fields }
StructLoadElementNode retrieves a value by key from a struct
func (StructLoadElementNode) String ¶
func (slen StructLoadElementNode) String() string
type StructTypeNode ¶
type StructTypeNode struct { SourceName string Types []TypeNode Names map[string]int IsVariadic bool // contains filtered or unexported fields }
StructTypeNode refers to a struct type
func (StructTypeNode) GetName ¶
func (stn StructTypeNode) GetName() string
func (StructTypeNode) SetName ¶
func (stn StructTypeNode) SetName(name string)
func (StructTypeNode) String ¶
func (stn StructTypeNode) String() string
func (StructTypeNode) Type ¶
func (stn StructTypeNode) Type() string
func (StructTypeNode) Variadic ¶
func (stn StructTypeNode) Variadic() bool
type SwitchCaseNode ¶ added in v0.2.0
type SwitchCaseNode struct { Conditions []Node Body []Node Fallthrough bool // contains filtered or unexported fields }
func (SwitchCaseNode) String ¶ added in v0.2.0
func (s SwitchCaseNode) String() string
type SwitchNode ¶ added in v0.2.0
type SwitchNode struct { Item Node Cases []*SwitchCaseNode DefaultBody []Node // can be null // contains filtered or unexported fields }
func (SwitchNode) String ¶ added in v0.2.0
func (s SwitchNode) String() string
type TypeCastInterfaceNode ¶
type TypeCastInterfaceNode struct { Item Node Type TypeNode // contains filtered or unexported fields }
func (TypeCastInterfaceNode) String ¶
func (i TypeCastInterfaceNode) String() string
type TypeCastNode ¶
TypeCastNode tries to cast Val to Type
func (TypeCastNode) String ¶
func (tcn TypeCastNode) String() string
type TypeNode ¶
type TypeNode interface { Node() // must also implement the Node interface Type() string String() string Variadic() bool SetName(string) GetName() string }
TypeNode is an interface for different ways of creating new types or referring to existing ones
type VersionScheme ¶
type VersionScheme struct { Major int Minor int Patch int // contains filtered or unexported fields }
VersionScheme implements the Node interface, to specify the compiler version
func (VersionScheme) String ¶
func (v VersionScheme) String() string