mirror of
https://github.com/bearlanguageorg/bear.git
synced 2026-08-26 15:37:18 +00:00
Production pass: floats, GC, type checking, and tooling
Adds floats, bitwise ops, UTF-8 strings with methods, try/catch, closures, generics validation, a compile-time type checker, a mark-and-sweep GC, source-level debug info, constant folding, and the repl/fmt/package-manager commands. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -47,3 +47,61 @@ const op_shas = u8(40) // has(map, "key") -> 1 if key exists, 0 otherwise
|
||||
const op_sdel = u8(41) // delete(map, "key") -> removes the key
|
||||
const op_slen = u8(42) // slen(struct) -> number of fields
|
||||
const op_skeys = u8(43) // skeys(struct) -> array of field name strings
|
||||
const op_slice = u8(44) // slice(arr/str, start, end) -> sliced arr/str
|
||||
const op_push_f = u8(45) // push a float literal (8-byte little-endian f64)
|
||||
const op_native = u8(46) // call a host builtin: <id:i64> <argc:i64>
|
||||
const op_and_b = u8(47) // bitwise AND
|
||||
const op_or_b = u8(48) // bitwise OR
|
||||
const op_xor = u8(49) // bitwise XOR
|
||||
const op_shl = u8(50) // shift left
|
||||
const op_shr = u8(51) // shift right
|
||||
const op_not_b = u8(52) // bitwise NOT
|
||||
const op_try = u8(53) // push handler: <catch_ip:i64>
|
||||
const op_throw = u8(54) // throw: pop error, unwind to nearest handler, push error
|
||||
const op_catch_done = u8(55) // pop handler (normal completion)
|
||||
const op_closure = u8(56) // push closure: <entry:i64>
|
||||
const op_call_closure = u8(57) // call closure: <argc:i64>
|
||||
const op_argc = u8(58) // push the current frame's arg count
|
||||
const op_load_dyn = u8(59) // pop idx, push stack[bp + idx]
|
||||
const op_varargs = u8(60) // <named:i64> <dst:i64> — collect args[named..argc-1] into array at local dst
|
||||
const op_str_method = u8(61) // <name:str> <argc:i64> — call a string method (s.len(), s.contains(x), ...)
|
||||
|
||||
// native builtin ids (the operand to op_native)
|
||||
const native_abs = 100
|
||||
const native_min = 101
|
||||
const native_max = 102
|
||||
const native_pow = 103
|
||||
const native_sqrt = 104
|
||||
const native_floor = 105
|
||||
const native_ceil = 106
|
||||
const native_round = 107
|
||||
const native_rand = 108
|
||||
const native_rand_int = 109
|
||||
const native_int = 110
|
||||
const native_str = 111
|
||||
const native_float = 112
|
||||
const native_type = 113
|
||||
const native_split = 114
|
||||
const native_join = 115
|
||||
const native_contains = 116
|
||||
const native_starts_with = 117
|
||||
const native_ends_with = 118
|
||||
const native_trim = 119
|
||||
const native_lower = 120
|
||||
const native_upper = 121
|
||||
const native_pop = 122
|
||||
const native_insert = 123
|
||||
const native_remove = 124
|
||||
const native_sort = 125
|
||||
const native_clone = 126
|
||||
const native_reverse = 127
|
||||
const native_index_of = 128
|
||||
const native_args = 129
|
||||
const native_getenv = 130
|
||||
const native_setenv = 131
|
||||
const native_exit = 132
|
||||
const native_time = 133
|
||||
const native_sleep = 134
|
||||
const native_read_file = 135
|
||||
const native_write_file = 136
|
||||
const native_eprint = 137
|
||||
|
||||
Reference in New Issue
Block a user