Files
hakorune/apps/selfhost/vm/mir_min_entry.nyash

14 lines
608 B
Plaintext
Raw Normal View History

// mir_min_entry.nyash — MirVmMin の薄いエントリ
// 引数があれば JSON を第1引数から受け取る。無ければデフォルトの const→ret (42)。
using selfhost.vm.mir_min as MirVmMin
static box Main {
main(args) {
// 既定の最小 MIR(JSON v0)
local json = "{\"functions\":[{\"name\":\"main\",\"params\":[],\"blocks\":[{\"id\":0,\"instructions\":[{\"op\":\"const\",\"dst\":1,\"value\":{\"type\":\"i64\",\"value\":42}},{\"op\":\"ret\",\"value\":1}]}]}]}"
if args { if args.size() > 0 { local s = args.get(0) if s { json = s } } }
return MirVmMin.run(json)
}
}