aboutsummaryrefslogtreecommitdiff
path: root/cmd/headless_interpreter/main.go
diff options
context:
space:
mode:
authorJulien Dessaux2021-12-03 23:28:12 +0100
committerJulien Dessaux2021-12-03 23:28:12 +0100
commit18b11177494c4704acc17586e7527d8e6ed9e941 (patch)
treeded430df6e33a42ddd0353420d7174d6d8c7fc02 /cmd/headless_interpreter/main.go
parentRefactoring : isolate stack manipulation into their own package (diff)
downloadgofunge98-18b11177494c4704acc17586e7527d8e6ed9e941.tar.gz
gofunge98-18b11177494c4704acc17586e7527d8e6ed9e941.tar.bz2
gofunge98-18b11177494c4704acc17586e7527d8e6ed9e941.zip
Renamed headless_interpreter to gofunge98
Diffstat (limited to 'cmd/headless_interpreter/main.go')
-rw-r--r--cmd/headless_interpreter/main.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/cmd/headless_interpreter/main.go b/cmd/headless_interpreter/main.go
deleted file mode 100644
index 3d2329a..0000000
--- a/cmd/headless_interpreter/main.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package main
-
-import (
- "flag"
- "fmt"
- "os"
-
- "git.adyxax.org/adyxax/gofunge98/pkg/field"
- "git.adyxax.org/adyxax/gofunge98/pkg/interpreter"
- "git.adyxax.org/adyxax/gofunge98/pkg/pointer"
-)
-
-func main() {
- filename := flag.String("f", "", "b98 file to interpret")
- help := flag.Bool("h", false, "display this help message")
- flag.Parse()
-
- if *help {
- flag.Usage()
- os.Exit(0)
- }
-
- if *filename == "" {
- fmt.Println("Error : no b98 file to interpret")
- flag.Usage()
- os.Exit(1)
- }
- file, err := os.Open(*filename)
- if err != nil {
- fmt.Printf("Failed to open file %s : %+v", *filename, err)
- os.Exit(2)
- }
- defer file.Close()
-
- f, err := field.Load(file)
- if err != nil {
- fmt.Printf("Failed to load file %s : %+v", *filename, err)
- os.Exit(3)
- }
- p := pointer.NewPointer()
- p.Argv = []string{*filename}
- v := interpreter.NewInterpreter(f, p).Run()
- os.Exit(v)
-}