github.com/arieschain/arieschain@v0.0.0-20191023063405-37c074544356/cmd/evm/internal/compiler/compiler.go (about) 1 2 package compiler 3 4 import ( 5 "errors" 6 "fmt" 7 8 "github.com/quickchainproject/quickchain/core/asm" 9 ) 10 11 func Compile(fn string, src []byte, debug bool) (string, error) { 12 compiler := asm.NewCompiler(debug) 13 compiler.Feed(asm.Lex(fn, src, debug)) 14 15 bin, compileErrors := compiler.Compile() 16 if len(compileErrors) > 0 { 17 // report errors 18 for _, err := range compileErrors { 19 fmt.Printf("%s:%v\n", fn, err) 20 } 21 return "", errors.New("compiling failed") 22 } 23 return bin, nil 24 }