Exemplo n.º 1
0
func main() {
	home := build8.NewDirHome(".", g8.Lang())
	home.AddLang("asm", asm8.Lang())
	home.AddLang("bare", g8.BareFunc())

	b := build8.NewBuilder(home)
	b.Verbose = true

	es := b.BuildAll()
	if es != nil {
		for _, e := range es {
			fmt.Println(e)
		}
		os.Exit(-1)
	}
}
Exemplo n.º 2
0
func buildSingle(fname, s string, lang build8.Lang) (
	image []byte, es []*lex8.Error, log []byte,
) {
	home := build8.NewMemHome(lang)
	home.AddLang("asm", asm8.Lang())

	pkg := home.NewPkg("main")
	name := filepath.Base(fname)
	pkg.AddFile(fname, name, s)

	builtin := home.NewPkg("asm/builtin")
	builtin.AddFile("", "builtin.s", builtInSrc)

	b := build8.NewBuilder(home)
	es = b.BuildAll()
	if es != nil {
		return nil, es, nil
	}

	return home.Bin("main"), nil, home.Log("main", "ir")
}