mirror of
https://github.com/bearlanguageorg/bear.git
synced 2026-08-26 14:57:18 +00:00
35 lines
481 B
V
35 lines
481 B
V
// types.v — core types and constants for the VuurRaaf VM.
|
|
module vm
|
|
|
|
const stack_cap = 65536
|
|
|
|
// Field is one `name: value` entry of a struct value.
|
|
struct Field {
|
|
mut:
|
|
name string
|
|
val i64
|
|
}
|
|
|
|
struct StructVal {
|
|
mut:
|
|
fields []Field
|
|
}
|
|
|
|
struct Vm {
|
|
mut:
|
|
code []u8
|
|
strings []string
|
|
arrays [][]i64
|
|
structs []StructVal
|
|
stack []i64
|
|
sp int
|
|
bp int
|
|
ip int
|
|
trace bool
|
|
halted bool
|
|
}
|
|
|
|
fn bool_i64(b bool) i64 {
|
|
return if b { i64(1) } else { i64(0) }
|
|
}
|