Documentation ¶
Overview ¶
Package bytecode provides the bytecode structure and some utilities for convenient use of bytecodes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BC ¶
type BC struct { N int // size Code []*instruction.Inst }
BC represents a line of instructions.
func (*BC) AddCode ¶
AddCode inserts the argument bytecode into BC. The argument integer i is the index where will insert into.
func (*BC) AddInst ¶
func (bc *BC) AddInst(inst *instruction.Inst, i int)
AddInst adds the argument instruction to BC. The argument integer i is the index where will insert to.
func (BC) IndexOf ¶
func (bc BC) IndexOf(sinst *instruction.Inst) int
IndexOf returns the position of argument instruction in BC. If can't find, then return -1.
func (*BC) PushInst ¶
func (bc *BC) PushInst(inst *instruction.Inst)
PushInst adds the argument instruction to the top of BC.
Click to show internal directories.
Click to hide internal directories.