summaryrefslogtreecommitdiff
path: root/vm/main.go
blob: 61aeebb9e6c1d7d7ed5e0cfacceb07711811c92f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main

import (
	"fmt"
	"os"
)

func main() {
	
	if (len(os.Args) != 2) {
		fmt.Fprintf(os.Stderr, "usage: %s bytecode.bin\n")
		os.Exit(1)
	}

	b, err := os.ReadFile(os.Args[1])

	if err != nil {
		fmt.Fprintf(os.Stderr, "failed to open file: %s\n", os.Args[1])
		os.Exit(1)
	}

	vm := NewEvm(b)

	vm.Start()
}