Install the package by doing go get:
go get github.com/slimdestro/brainfuckparser/pkg
compiler.Compile(syntax)
package main
import (
"github.com/slimdestro/brainfuckparser/pkg"
"io/ioutil"
"errors"
"log"
"os"
)
/*
@ go run main.go bfsourcecodes/{fileName}
*/
func main() {
if len(os.Args) > 1 {
file, err := ioutil.ReadFile(os.Args[1])
if err != nil{
if errors.Is(err, os.ErrNotExist){
log.Println("Specified file doesnt exist!")
return
}else{
panic(err)
}
}
code := string(file)
compiler.Compile(code)
} else {
log.Fatal("a BrainFcuk source file is required")
}
}