Files
subcoding/asm/parse.go

23 lines
326 B
Go
Raw Normal View History

2021-11-18 19:35:24 -10:00
package asm
2021-11-16 21:08:46 -10:00
import "gopkg.in/yaml.v2"
2021-11-18 17:43:13 -10:00
type program struct {
Functions []function `yaml:"functions"`
2021-11-16 21:08:46 -10:00
}
2021-11-18 17:43:13 -10:00
type function []instruction
2021-11-16 21:08:46 -10:00
2021-11-18 17:43:13 -10:00
type instruction []string
2021-11-16 21:08:46 -10:00
2021-11-18 17:43:13 -10:00
func parse(src []byte) (*program, error) {
prog := &program{}
err := yaml.UnmarshalStrict(src, &prog)
2021-11-16 21:08:46 -10:00
if err != nil {
return nil, err
}
return prog, nil
}