Commit 299b50a0 authored by obscuren's avatar obscuren

Support serpent lang

parent 931ae0f1
......@@ -3,11 +3,22 @@ package ethutil
import (
"fmt"
"github.com/obscuren/mutan"
"github.com/obscuren/serpent-go"
"strings"
)
// General compile function
func Compile(script string) ([]byte, error) {
func Compile(script string) (ret []byte, err error) {
c := strings.Split(script, "\n")[0]
if c == "#!serpent" {
byteCode, err := serpent.Compile(script)
if err != nil {
return nil, err
}
return byteCode, nil
} else {
byteCode, errors := mutan.Compile(strings.NewReader(script), false)
if len(errors) > 0 {
var errs string
......@@ -20,6 +31,7 @@ func Compile(script string) ([]byte, error) {
}
return byteCode, nil
}
}
func CompileScript(script string) ([]byte, []byte, error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment