emitter

package
v0.0.0-...-fbe25eb Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OpCode_name = map[int32]string{
	0:  "NOP",
	1:  "PUSH",
	2:  "POP",
	3:  "LOCAL",
	4:  "LOAD",
	5:  "STORE",
	6:  "STORE_AT",
	7:  "SET_PIXEL",
	8:  "CALL",
	9:  "BR",
	10: "BR_FALSE",
	11: "LOG",
	12: "RET",
	13: "OR",
	14: "AND",
	15: "EQ",
	16: "GT",
	17: "GE",
	18: "LT",
	19: "LE",
	20: "CONCAT",
	21: "ADD",
	22: "SUB",
	23: "MUL",
	24: "DIV",
	25: "MOD",
	26: "IN",
	27: "NEG",
	28: "NOT",
	29: "MK_POINT",
	30: "CALL_MEMBER",
	31: "INDEX",
	32: "INDEX_RANGE",
	33: "GET_PIXEL",
	34: "MK_KERNEL",
	35: "MK_HASHMAP",
	36: "MK_LIST",
}
View Source
var OpCode_value = map[string]int32{
	"NOP":         0,
	"PUSH":        1,
	"POP":         2,
	"LOCAL":       3,
	"LOAD":        4,
	"STORE":       5,
	"STORE_AT":    6,
	"SET_PIXEL":   7,
	"CALL":        8,
	"BR":          9,
	"BR_FALSE":    10,
	"LOG":         11,
	"RET":         12,
	"OR":          13,
	"AND":         14,
	"EQ":          15,
	"GT":          16,
	"GE":          17,
	"LT":          18,
	"LE":          19,
	"CONCAT":      20,
	"ADD":         21,
	"SUB":         22,
	"MUL":         23,
	"DIV":         24,
	"MOD":         25,
	"IN":          26,
	"NEG":         27,
	"NOT":         28,
	"MK_POINT":    29,
	"CALL_MEMBER": 30,
	"INDEX":       31,
	"INDEX_RANGE": 32,
	"GET_PIXEL":   33,
	"MK_KERNEL":   34,
	"MK_HASHMAP":  35,
	"MK_LIST":     36,
}

Functions

func EmitJS

func EmitJS(program parser.Program) string

Types

type Instruction

type Instruction struct {
	Opcode OpCode `protobuf:"varint,1,opt,name=opcode,proto3,enum=emitter.OpCode" json:"opcode,omitempty"`
	// Types that are valid to be assigned to Arg:
	//	*Instruction_Integer
	//	*Instruction_Float
	//	*Instruction_Str
	Arg                  isInstruction_Arg `protobuf_oneof:"arg"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*Instruction) Descriptor

func (*Instruction) Descriptor() ([]byte, []int)

func (*Instruction) GetArg

func (m *Instruction) GetArg() isInstruction_Arg

func (*Instruction) GetFloat

func (m *Instruction) GetFloat() float32

func (*Instruction) GetInteger

func (m *Instruction) GetInteger() int32

func (*Instruction) GetOpcode

func (m *Instruction) GetOpcode() OpCode

func (*Instruction) GetStr

func (m *Instruction) GetStr() string

func (*Instruction) ProtoMessage

func (*Instruction) ProtoMessage()

func (*Instruction) Reset

func (m *Instruction) Reset()

func (*Instruction) String

func (m *Instruction) String() string

func (*Instruction) XXX_DiscardUnknown

func (m *Instruction) XXX_DiscardUnknown()

func (*Instruction) XXX_Marshal

func (m *Instruction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Instruction) XXX_Merge

func (m *Instruction) XXX_Merge(src proto.Message)

func (*Instruction) XXX_OneofWrappers

func (*Instruction) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*Instruction) XXX_Size

func (m *Instruction) XXX_Size() int

func (*Instruction) XXX_Unmarshal

func (m *Instruction) XXX_Unmarshal(b []byte) error

type Instruction_Float

type Instruction_Float struct {
	Float float32 `protobuf:"fixed32,3,opt,name=float,proto3,oneof"`
}

type Instruction_Integer

type Instruction_Integer struct {
	Integer int32 `protobuf:"varint,2,opt,name=integer,proto3,oneof"`
}

type Instruction_Str

type Instruction_Str struct {
	Str string `protobuf:"bytes,4,opt,name=str,proto3,oneof"`
}

type OpCode

type OpCode int32
const (
	OpCode_NOP         OpCode = 0
	OpCode_PUSH        OpCode = 1
	OpCode_POP         OpCode = 2
	OpCode_LOCAL       OpCode = 3
	OpCode_LOAD        OpCode = 4
	OpCode_STORE       OpCode = 5
	OpCode_STORE_AT    OpCode = 6
	OpCode_SET_PIXEL   OpCode = 7
	OpCode_CALL        OpCode = 8
	OpCode_BR          OpCode = 9
	OpCode_BR_FALSE    OpCode = 10
	OpCode_LOG         OpCode = 11
	OpCode_RET         OpCode = 12
	OpCode_OR          OpCode = 13
	OpCode_AND         OpCode = 14
	OpCode_EQ          OpCode = 15
	OpCode_GT          OpCode = 16
	OpCode_GE          OpCode = 17
	OpCode_LT          OpCode = 18
	OpCode_LE          OpCode = 19
	OpCode_CONCAT      OpCode = 20
	OpCode_ADD         OpCode = 21
	OpCode_SUB         OpCode = 22
	OpCode_MUL         OpCode = 23
	OpCode_DIV         OpCode = 24
	OpCode_MOD         OpCode = 25
	OpCode_IN          OpCode = 26
	OpCode_NEG         OpCode = 27
	OpCode_NOT         OpCode = 28
	OpCode_MK_POINT    OpCode = 29
	OpCode_CALL_MEMBER OpCode = 30
	OpCode_INDEX       OpCode = 31
	OpCode_INDEX_RANGE OpCode = 32
	OpCode_GET_PIXEL   OpCode = 33
	OpCode_MK_KERNEL   OpCode = 34
	OpCode_MK_HASHMAP  OpCode = 35
	OpCode_MK_LIST     OpCode = 36
)

func (OpCode) EnumDescriptor

func (OpCode) EnumDescriptor() ([]byte, []int)

func (OpCode) String

func (x OpCode) String() string

type Program

type Program struct {
	Instructions         []*Instruction `protobuf:"bytes,1,rep,name=instructions,proto3" json:"instructions,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func Emit

func Emit(program parser.Program) Program

func (*Program) Descriptor

func (*Program) Descriptor() ([]byte, []int)

func (*Program) GetInstructions

func (m *Program) GetInstructions() []*Instruction

func (*Program) ProtoMessage

func (*Program) ProtoMessage()

func (*Program) Reset

func (m *Program) Reset()

func (*Program) String

func (m *Program) String() string

func (*Program) XXX_DiscardUnknown

func (m *Program) XXX_DiscardUnknown()

func (*Program) XXX_Marshal

func (m *Program) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Program) XXX_Merge

func (m *Program) XXX_Merge(src proto.Message)

func (*Program) XXX_Size

func (m *Program) XXX_Size() int

func (*Program) XXX_Unmarshal

func (m *Program) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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