Documentation ¶
Index ¶
- Variables
- func LastReturn(ctx context.Context) interface{}
- func NodeCompare(lhs, rhs *NodeIL) bool
- func Run(i *Implementation, src string) error
- type Implementation
- type MacC
- type Machine
- type NodeIL
- func (*NodeIL) Descriptor() ([]byte, []int)
- func (m *NodeIL) GetChained() *NodeIL
- func (m *NodeIL) GetChildren() []*NodeIL
- func (m *NodeIL) GetId() []byte
- func (m *NodeIL) GetKind() NodeIL_Kind
- func (m *NodeIL) GetSubType() string
- func (m *NodeIL) GetValue() *NodeIL_DValue
- func (*NodeIL) ProtoMessage()
- func (m *NodeIL) Reset()
- func (m *NodeIL) String() string
- func (m *NodeIL) XXX_DiscardUnknown()
- func (m *NodeIL) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NodeIL) XXX_Merge(src proto.Message)
- func (m *NodeIL) XXX_Size() int
- func (m *NodeIL) XXX_Unmarshal(b []byte) error
- type NodeIL_DValue
- func (*NodeIL_DValue) Descriptor() ([]byte, []int)
- func (m *NodeIL_DValue) GetBool() bool
- func (m *NodeIL_DValue) GetFlt() float64
- func (m *NodeIL_DValue) GetKind() NodeIL_DValue_Kind
- func (m *NodeIL_DValue) GetStr() string
- func (*NodeIL_DValue) ProtoMessage()
- func (m *NodeIL_DValue) Reset()
- func (m *NodeIL_DValue) String() string
- func (m *NodeIL_DValue) XXX_DiscardUnknown()
- func (m *NodeIL_DValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NodeIL_DValue) XXX_Merge(src proto.Message)
- func (m *NodeIL_DValue) XXX_Size() int
- func (m *NodeIL_DValue) XXX_Unmarshal(b []byte) error
- type NodeIL_DValue_Kind
- type NodeIL_Kind
- type ProgramIL
- func (*ProgramIL) Descriptor() ([]byte, []int)
- func (m *ProgramIL) GetEntry() *NodeIL
- func (m *ProgramIL) GetFuncCalls() map[string]uint64
- func (m *ProgramIL) GetId() []byte
- func (m *ProgramIL) GetSource() string
- func (p *ProgramIL) IR() ([]byte, error)
- func (p *ProgramIL) LoadIR(ir []byte) error
- func (*ProgramIL) ProtoMessage()
- func (m *ProgramIL) Reset()
- func (m *ProgramIL) String() string
- func (m *ProgramIL) XXX_DiscardUnknown()
- func (m *ProgramIL) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ProgramIL) XXX_Merge(src proto.Message)
- func (m *ProgramIL) XXX_Size() int
- func (m *ProgramIL) XXX_Unmarshal(b []byte) error
- type RuntimeError
- type SourceError
- type SyntaxError
- type TokenIL
- func (*TokenIL) Descriptor() ([]byte, []int)
- func (m *TokenIL) GetColumn() uint32
- func (m *TokenIL) GetKind() TokenIL_Kind
- func (m *TokenIL) GetLine() uint32
- func (m *TokenIL) GetValue() string
- func (*TokenIL) ProtoMessage()
- func (m *TokenIL) Reset()
- func (m *TokenIL) String() string
- func (m *TokenIL) XXX_DiscardUnknown()
- func (m *TokenIL) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TokenIL) XXX_Merge(src proto.Message)
- func (m *TokenIL) XXX_Size() int
- func (m *TokenIL) XXX_Unmarshal(b []byte) error
- type TokenIL_Kind
Constants ¶
This section is empty.
Variables ¶
var NodeIL_DValue_Kind_name = map[int32]string{
0: "STR",
1: "FLT",
2: "BOOL",
}
var NodeIL_DValue_Kind_value = map[string]int32{
"STR": 0,
"FLT": 1,
"BOOL": 2,
}
var NodeIL_Kind_name = map[int32]string{
0: "NONE",
1: "ROOT",
2: "GROUP",
3: "FUNC",
4: "VALUE",
5: "ASSIGN",
6: "VAR",
7: "NAT",
}
var NodeIL_Kind_value = map[string]int32{
"NONE": 0,
"ROOT": 1,
"GROUP": 2,
"FUNC": 3,
"VALUE": 4,
"ASSIGN": 5,
"VAR": 6,
"NAT": 7,
}
var TokenIL_Kind_name = map[int32]string{
0: "NONE",
1: "VALUE",
2: "OPEN",
3: "CLOSE",
4: "END",
5: "DOT",
6: "PIPE",
7: "ASSIGN",
8: "VAR",
}
var TokenIL_Kind_value = map[string]int32{
"NONE": 0,
"VALUE": 1,
"OPEN": 2,
"CLOSE": 3,
"END": 4,
"DOT": 5,
"PIPE": 6,
"ASSIGN": 7,
"VAR": 8,
}
Functions ¶
func LastReturn ¶
LastReturn gets the last returned value from the context
func NodeCompare ¶
NodeCompare compares all nodes. The ID can be different, but all sub-values must be the same.
func Run ¶
func Run(i *Implementation, src string) error
Run takes raw source and compiles it and runs in a new machine.
Types ¶
type Implementation ¶
type Implementation struct {
// contains filtered or unexported fields
}
Implementation contains the implementation of a machine
func (*Implementation) Func ¶
func (i *Implementation) Func(name string, handler interface{})
Func adds a function handler to the implementation
func (*Implementation) Functions ¶
func (i *Implementation) Functions() []string
Functions returns a list of function documentation.
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
Machine is the VM that will run a program.
type NodeIL ¶
type NodeIL struct { Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Kind NodeIL_Kind `protobuf:"varint,2,opt,name=kind,proto3,enum=machine.NodeIL_Kind" json:"kind,omitempty"` Children []*NodeIL `protobuf:"bytes,3,rep,name=children,proto3" json:"children,omitempty"` Chained *NodeIL `protobuf:"bytes,4,opt,name=chained,proto3" json:"chained,omitempty"` Value *NodeIL_DValue `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"` SubType string `protobuf:"bytes,6,opt,name=sub_type,json=subType,proto3" json:"sub_type,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*NodeIL) Descriptor ¶
func (*NodeIL) GetChained ¶
func (*NodeIL) GetChildren ¶
func (*NodeIL) GetKind ¶
func (m *NodeIL) GetKind() NodeIL_Kind
func (*NodeIL) GetSubType ¶
func (*NodeIL) GetValue ¶
func (m *NodeIL) GetValue() *NodeIL_DValue
func (*NodeIL) ProtoMessage ¶
func (*NodeIL) ProtoMessage()
func (*NodeIL) XXX_DiscardUnknown ¶
func (m *NodeIL) XXX_DiscardUnknown()
func (*NodeIL) XXX_Marshal ¶
func (*NodeIL) XXX_Unmarshal ¶
type NodeIL_DValue ¶
type NodeIL_DValue struct { Kind NodeIL_DValue_Kind `protobuf:"varint,1,opt,name=kind,proto3,enum=machine.NodeIL_DValue_Kind" json:"kind,omitempty"` Str string `protobuf:"bytes,2,opt,name=str,proto3" json:"str,omitempty"` Flt float64 `protobuf:"fixed64,3,opt,name=flt,proto3" json:"flt,omitempty"` Bool bool `protobuf:"varint,4,opt,name=bool,proto3" json:"bool,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*NodeIL_DValue) Descriptor ¶
func (*NodeIL_DValue) Descriptor() ([]byte, []int)
func (*NodeIL_DValue) GetBool ¶
func (m *NodeIL_DValue) GetBool() bool
func (*NodeIL_DValue) GetFlt ¶
func (m *NodeIL_DValue) GetFlt() float64
func (*NodeIL_DValue) GetKind ¶
func (m *NodeIL_DValue) GetKind() NodeIL_DValue_Kind
func (*NodeIL_DValue) GetStr ¶
func (m *NodeIL_DValue) GetStr() string
func (*NodeIL_DValue) ProtoMessage ¶
func (*NodeIL_DValue) ProtoMessage()
func (*NodeIL_DValue) Reset ¶
func (m *NodeIL_DValue) Reset()
func (*NodeIL_DValue) String ¶
func (m *NodeIL_DValue) String() string
func (*NodeIL_DValue) XXX_DiscardUnknown ¶
func (m *NodeIL_DValue) XXX_DiscardUnknown()
func (*NodeIL_DValue) XXX_Marshal ¶
func (m *NodeIL_DValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*NodeIL_DValue) XXX_Merge ¶
func (m *NodeIL_DValue) XXX_Merge(src proto.Message)
func (*NodeIL_DValue) XXX_Size ¶
func (m *NodeIL_DValue) XXX_Size() int
func (*NodeIL_DValue) XXX_Unmarshal ¶
func (m *NodeIL_DValue) XXX_Unmarshal(b []byte) error
type NodeIL_DValue_Kind ¶
type NodeIL_DValue_Kind int32
const ( NodeIL_DValue_STR NodeIL_DValue_Kind = 0 NodeIL_DValue_FLT NodeIL_DValue_Kind = 1 NodeIL_DValue_BOOL NodeIL_DValue_Kind = 2 )
func (NodeIL_DValue_Kind) EnumDescriptor ¶
func (NodeIL_DValue_Kind) EnumDescriptor() ([]byte, []int)
func (NodeIL_DValue_Kind) String ¶
func (x NodeIL_DValue_Kind) String() string
type NodeIL_Kind ¶
type NodeIL_Kind int32
const ( NodeIL_NONE NodeIL_Kind = 0 NodeIL_ROOT NodeIL_Kind = 1 NodeIL_GROUP NodeIL_Kind = 2 NodeIL_FUNC NodeIL_Kind = 3 NodeIL_VALUE NodeIL_Kind = 4 NodeIL_ASSIGN NodeIL_Kind = 5 NodeIL_VAR NodeIL_Kind = 6 NodeIL_NAT NodeIL_Kind = 7 )
func (NodeIL_Kind) EnumDescriptor ¶
func (NodeIL_Kind) EnumDescriptor() ([]byte, []int)
func (NodeIL_Kind) String ¶
func (x NodeIL_Kind) String() string
type ProgramIL ¶
type ProgramIL struct { Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` Entry *NodeIL `protobuf:"bytes,3,opt,name=entry,proto3" json:"entry,omitempty"` FuncCalls map[string]uint64 `` /* 177-byte string literal not displayed */ XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func CompileSource ¶
CompileSource takes source code and turns it into a machine program.
func (*ProgramIL) Descriptor ¶
func (*ProgramIL) GetFuncCalls ¶
func (*ProgramIL) ProtoMessage ¶
func (*ProgramIL) ProtoMessage()
func (*ProgramIL) XXX_DiscardUnknown ¶
func (m *ProgramIL) XXX_DiscardUnknown()
func (*ProgramIL) XXX_Marshal ¶
func (*ProgramIL) XXX_Unmarshal ¶
type RuntimeError ¶
RuntimeError represents and error raised when the machine encounters something it doesn't expect.
func (RuntimeError) Error ¶
func (e RuntimeError) Error() string
type SourceError ¶
SourceError is returned when the source code reader encounters and error
func (*SourceError) Error ¶
func (e *SourceError) Error() string
type SyntaxError ¶
SyntaxError is thrown when the parser encounters a token that it is not expecting.
func (*SyntaxError) Error ¶
func (e *SyntaxError) Error() string
type TokenIL ¶
type TokenIL struct { Kind TokenIL_Kind `protobuf:"varint,1,opt,name=kind,proto3,enum=machine.TokenIL_Kind" json:"kind,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` Line uint32 `protobuf:"varint,3,opt,name=line,proto3" json:"line,omitempty"` Column uint32 `protobuf:"varint,4,opt,name=column,proto3" json:"column,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*TokenIL) Descriptor ¶
func (*TokenIL) GetKind ¶
func (m *TokenIL) GetKind() TokenIL_Kind
func (*TokenIL) ProtoMessage ¶
func (*TokenIL) ProtoMessage()
func (*TokenIL) XXX_DiscardUnknown ¶
func (m *TokenIL) XXX_DiscardUnknown()
func (*TokenIL) XXX_Marshal ¶
func (*TokenIL) XXX_Unmarshal ¶
type TokenIL_Kind ¶
type TokenIL_Kind int32
const ( TokenIL_NONE TokenIL_Kind = 0 TokenIL_VALUE TokenIL_Kind = 1 TokenIL_OPEN TokenIL_Kind = 2 TokenIL_CLOSE TokenIL_Kind = 3 TokenIL_END TokenIL_Kind = 4 TokenIL_DOT TokenIL_Kind = 5 TokenIL_PIPE TokenIL_Kind = 6 TokenIL_ASSIGN TokenIL_Kind = 7 TokenIL_VAR TokenIL_Kind = 8 )
func (TokenIL_Kind) EnumDescriptor ¶
func (TokenIL_Kind) EnumDescriptor() ([]byte, []int)
func (TokenIL_Kind) String ¶
func (x TokenIL_Kind) String() string