示例#1
0
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()
}
示例#2
0
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()
}