예제 #1
0
파일: main.go 프로젝트: yingmsky/e8vm
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)
	}
}
예제 #2
0
파일: bare_func.go 프로젝트: yingmsky/e8vm
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")
}