Esempio n. 1
0
func main() {
	flag.Parse()
	if *cpuProfile != "" {
		f, err := os.Create(*cpuProfile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	checkInitPC()

	lang := g8.Lang(*golike)
	home := build8.NewDirHome(*homeDir, lang)
	home.AddLang("asm", asm8.Lang())
	home.AddLang("bare", g8.BareFunc())

	b := build8.NewBuilder(home, home)
	b.Verbose = true
	b.InitPC = uint32(*initPC)
	b.RunTests = *runTests
	b.StaticOnly = *staticOnly

	var es []*lex8.Error
	if *pkg == "" {
		es = b.BuildAll()
	} else if strings.HasSuffix(*pkg, "...") {
		prefix := strings.TrimSuffix(*pkg, "...")
		b.BuildPrefix(prefix)
	} else {
		es = b.Build(*pkg)
	}

	if es != nil {
		for _, e := range es {
			fmt.Println(e)
		}
		os.Exit(-1)
	}
}
Esempio n. 2
0
func main() {
	flag.Parse()
	if *cpuProfile != "" {
		f, err := os.Create(*cpuProfile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	checkInitPC()

	var lang build8.Lang
	if !*golike {
		lang = g8.Lang()
	} else {
		lang = g8.LangGolike()
	}

	home := build8.NewDirHome(".", lang)
	home.AddLang("asm", asm8.Lang())
	home.AddLang("bare", g8.BareFunc())

	b := build8.NewBuilder(home)
	b.Verbose = true
	b.InitPC = uint32(*initPC)
	b.RunTests = *runTests

	es := b.BuildAll()
	if es != nil {
		for _, e := range es {
			fmt.Println(e)
		}
		os.Exit(-1)
	}
}