go-vise

Constrained Size Output Virtual Machine
Info | Log | Files | Refs | README | LICENSE

main.go (396B)


      1 package main
      2 
      3 import (
      4 	"fmt"
      5 	"os"
      6 	"io/ioutil"
      7 
      8 	"git.defalsify.org/vise.git/vm"
      9 )
     10 
     11 func main() {
     12 	if (len(os.Args) < 2) {
     13 		os.Exit(1)
     14 	}
     15 	fp := os.Args[1]
     16 	v, err := ioutil.ReadFile(fp)
     17 	if err != nil {
     18 		fmt.Fprintf(os.Stderr, "read error: %v", err)
     19 		os.Exit(1)
     20 	}
     21 	r, err := vm.ToString(v)
     22 	if err != nil {
     23 		fmt.Fprintf(os.Stderr, "parse error: %v", err)
     24 		os.Exit(1)
     25 	}
     26 	fmt.Printf(r)
     27 }