16 lines
265 B
Go
16 lines
265 B
Go
|
|
package gen
|
||
|
|
|
||
|
|
import "github.com/firestuff/subcoding/vm"
|
||
|
|
|
||
|
|
func randInstruction() *vm.Instruction {
|
||
|
|
instr := &vm.Instruction{
|
||
|
|
OpCode: randOpCode(),
|
||
|
|
}
|
||
|
|
|
||
|
|
for i, t := range vm.OperandsByOpCode[instr.OpCode] {
|
||
|
|
instr.Operands[i] = randOperand(t)
|
||
|
|
}
|
||
|
|
|
||
|
|
return instr
|
||
|
|
}
|