aboutsummaryrefslogtreecommitdiff
path: root/parse.go
diff options
context:
space:
mode:
Diffstat (limited to 'parse.go')
-rw-r--r--parse.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/parse.go b/parse.go
index 76579ae..0c9d5a2 100644
--- a/parse.go
+++ b/parse.go
@@ -2,7 +2,7 @@ package j1
import "fmt"
-// Decode instruction
+// Decode instruction from binary form
func Decode(v uint16) Instruction {
switch {
case isLiteral(v):
@@ -19,6 +19,11 @@ func Decode(v uint16) Instruction {
return nil
}
+// Encode instruction to binary form
+func Encode(i Instruction) uint16 {
+ return i.compile()
+}
+
// Instruction interface
type Instruction interface {
value() uint16