Split packages
This commit is contained in:
22
asm/parse.go
Normal file
22
asm/parse.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package asm
|
||||
|
||||
import "gopkg.in/yaml.v2"
|
||||
|
||||
type program struct {
|
||||
Functions []function `yaml:"functions"`
|
||||
}
|
||||
|
||||
type function []instruction
|
||||
|
||||
type instruction []string
|
||||
|
||||
func parse(src []byte) (*program, error) {
|
||||
prog := &program{}
|
||||
|
||||
err := yaml.UnmarshalStrict(src, &prog)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return prog, nil
|
||||
}
|
||||
Reference in New Issue
Block a user