func main() { // create a new reader and initialze a parser with it buf, _ := ioutil.ReadFile(os.Args[1]) reader := bytes.NewReader(buf) p := new(compiler.Parser) p.Scanner = compiler.Scanner{Reader: *reader} p.SystemGoal() }
func main() { // the file for reading src, _ := ioutil.ReadFile(os.Args[1]) reader := bytes.NewReader(src) // the file for writing dst, _ := os.Create(os.Args[2]) writer := bufio.NewWriter(dst) defer dst.Close() // setup the parser p := compiler.Parser{Writer: *writer} p.Scanner = compiler.Scanner{Reader: *reader} // parse the file! p.SystemGoal() }