nomen-lang 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/NOMEN_AGENTS.md +235 -0
  2. package/core/System/Ansi.nm +150 -0
  3. package/core/System/Array.nm +358 -0
  4. package/core/System/BigInt.nm +887 -0
  5. package/core/System/Buffer.nm +526 -0
  6. package/core/System/Channel.nm +198 -0
  7. package/core/System/ClassBuffer.nm +229 -0
  8. package/core/System/Console.nm +211 -0
  9. package/core/System/Controls/Button.nm +138 -0
  10. package/core/System/Controls/CheckBox.nm +158 -0
  11. package/core/System/Controls/Container.nm +1562 -0
  12. package/core/System/Controls/Control.nm +28 -0
  13. package/core/System/Controls/Geometry.nm +101 -0
  14. package/core/System/Controls/Layout.nm +228 -0
  15. package/core/System/Controls/LayoutParams.nm +50 -0
  16. package/core/System/Controls/Text.nm +129 -0
  17. package/core/System/Controls/TextBox.nm +157 -0
  18. package/core/System/Controls/Window.nm +280 -0
  19. package/core/System/Disposable.nm +8 -0
  20. package/core/System/Enumerable.nm +10 -0
  21. package/core/System/Equatable.nm +10 -0
  22. package/core/System/Graph.nm +68 -0
  23. package/core/System/Hashable.nm +13 -0
  24. package/core/System/Init.nm +21 -0
  25. package/core/System/LinkedList.nm +64 -0
  26. package/core/System/List.nm +44 -0
  27. package/core/System/Map.nm +153 -0
  28. package/core/System/Math.nm +54 -0
  29. package/core/System/Mutex.nm +78 -0
  30. package/core/System/Nursery.nm +27 -0
  31. package/core/System/Sendable.nm +9 -0
  32. package/core/System/Set.nm +97 -0
  33. package/core/System/Stream/Directory.nm +176 -0
  34. package/core/System/Stream/File.nm +432 -0
  35. package/core/System/Stream/Http.nm +453 -0
  36. package/core/System/String.nm +154 -0
  37. package/core/System/StringBuilder.nm +249 -0
  38. package/core/System/Stringable.nm +8 -0
  39. package/core/System/Task.nm +263 -0
  40. package/core/System/Test.nm +241 -0
  41. package/core/System/Text/Json.nm +377 -0
  42. package/core/System/Text/JsonTree.nm +187 -0
  43. package/core/System/Text/Regex.nm +655 -0
  44. package/core/System/Time.nm +112 -0
  45. package/core/System/Tree.nm +70 -0
  46. package/core/System/Viewable.nm +27 -0
  47. package/core/System/bool.nm +66 -0
  48. package/core/System/char.nm +42 -0
  49. package/core/System/float.nm +43 -0
  50. package/core/System/int.nm +54 -0
  51. package/core/System/int64.nm +42 -0
  52. package/core/System/int8.nm +42 -0
  53. package/core/System/uint.nm +42 -0
  54. package/core/System/uint64.nm +42 -0
  55. package/core/System/uint8.nm +42 -0
  56. package/core/docs/System/Ansi.md +40 -0
  57. package/core/docs/System/Array.md +16 -0
  58. package/core/docs/System/BigInt.md +30 -0
  59. package/core/docs/System/Buffer.md +31 -0
  60. package/core/docs/System/Channel.md +10 -0
  61. package/core/docs/System/ClassBuffer.md +15 -0
  62. package/core/docs/System/Console.md +13 -0
  63. package/core/docs/System/Controls/Button.md +12 -0
  64. package/core/docs/System/Controls/CheckBox.md +15 -0
  65. package/core/docs/System/Controls/Container.md +82 -0
  66. package/core/docs/System/Controls/Control.md +5 -0
  67. package/core/docs/System/Controls/Geometry.md +26 -0
  68. package/core/docs/System/Controls/Layout.md +37 -0
  69. package/core/docs/System/Controls/LayoutParams.md +13 -0
  70. package/core/docs/System/Controls/Text.md +12 -0
  71. package/core/docs/System/Controls/TextBox.md +13 -0
  72. package/core/docs/System/Controls/Window.md +20 -0
  73. package/core/docs/System/Disposable.md +5 -0
  74. package/core/docs/System/Enumerable.md +5 -0
  75. package/core/docs/System/Graph.md +17 -0
  76. package/core/docs/System/Init.md +9 -0
  77. package/core/docs/System/LinkedList.md +16 -0
  78. package/core/docs/System/List.md +13 -0
  79. package/core/docs/System/Map.md +14 -0
  80. package/core/docs/System/Math.md +11 -0
  81. package/core/docs/System/Mutex.md +10 -0
  82. package/core/docs/System/Nursery.md +5 -0
  83. package/core/docs/System/Sendable.md +5 -0
  84. package/core/docs/System/Set.md +14 -0
  85. package/core/docs/System/Stream/Directory.md +12 -0
  86. package/core/docs/System/Stream/File.md +21 -0
  87. package/core/docs/System/String.md +14 -0
  88. package/core/docs/System/StringBuilder.md +12 -0
  89. package/core/docs/System/Stringable.md +5 -0
  90. package/core/docs/System/Task.md +15 -0
  91. package/core/docs/System/Text/Json.md +12 -0
  92. package/core/docs/System/Text/JsonTree.md +21 -0
  93. package/core/docs/System/Text/Regex.md +12 -0
  94. package/core/docs/System/Time.md +11 -0
  95. package/core/docs/System/Tree.md +18 -0
  96. package/core/docs/System/Viewable.md +5 -0
  97. package/core/docs/System/bool.md +9 -0
  98. package/core/docs/System/char.md +9 -0
  99. package/core/docs/System/float.md +9 -0
  100. package/core/docs/System/int.md +10 -0
  101. package/core/docs/System/int64.md +9 -0
  102. package/core/docs/System/int8.md +9 -0
  103. package/core/docs/System/uint.md +9 -0
  104. package/core/docs/System/uint64.md +9 -0
  105. package/core/docs/System/uint8.md +9 -0
  106. package/core/package.jsonc +4 -0
  107. package/dist/index.mjs +417 -5490
  108. package/package.json +33 -30
  109. package/src/args.ts +171 -0
  110. package/src/index.ts +53 -104
  111. package/src/init.ts +128 -0
  112. package/src/test.ts +6 -2
  113. package/test/fixtures/build/calc.test +0 -0
  114. package/test/fixtures/build/calc.test.c +0 -969
  115. package/test/fixtures/build/main.h +0 -170
  116. package/test/fixtures/calc.test.nm +0 -32
  117. package/tsconfig.json +0 -21
  118. package/vite.config.ts +0 -7
@@ -0,0 +1,30 @@
1
+ # BigInt
2
+
3
+ ## `struct BigInt`
4
+
5
+ An arbitrary-precision integer
6
+
7
+ **Members:**
8
+
9
+ - `new(int val) -> BigInt`
10
+ - `get(int i) -> uint64`
11
+ - `set(int i, uint64 val)`
12
+ - `data_ptr() -> uint64`
13
+ - `get_at(uint64 ptr, int i) -> uint64`
14
+ - `set_at(uint64 ptr, int i, uint64 val)`
15
+ - `ensure(int needed)`
16
+ - `clear(int len)`
17
+ - `copy_range_from(BigInt src, int start, int count)`
18
+ - `add_at(BigInt other, int shift)`
19
+ - `sub_at(BigInt other, int shift)`
20
+ - `div128(uint64 hi, uint64 lo, uint64 d) -> uint64`
21
+ - `mul_wide_hi(uint64 a, uint64 b) -> uint64`
22
+ - `cmp(BigInt other) -> int`
23
+ - `add_to(BigInt a, BigInt b) -> void`
24
+ - `sub_to(BigInt a, BigInt b) -> void`
25
+ - `mul_to(BigInt a, BigInt b, ref BigInt scratch) -> void`
26
+ - `div_to(BigInt a, BigInt b, ref BigInt remainder) -> void`
27
+ - `to_digit() -> int`
28
+ - `copy_from(BigInt other)`
29
+ - `set_int(int val)`
30
+ - `set_u64(uint64 val)`
@@ -0,0 +1,31 @@
1
+ # Buffer
2
+
3
+ ## `struct Buffer<T>`
4
+
5
+ A flat, low-level buffer of value slots of type T — the backing store for arrays and collections
6
+
7
+ **Members:**
8
+
9
+ - `alloc(int size) -> int`
10
+ - `grow(int needed) -> int`
11
+ - `zero(int len)`
12
+ - `load(int i) -> uint32`
13
+ - `store(int i, uint32 val)`
14
+ - `store_or(int i, uint32 val)`
15
+ - `alloc_int(int size) -> int`
16
+ - `grow_int(int needed) -> int`
17
+ - `load_int(int i) -> int`
18
+ - `store_int(int i, int val)`
19
+ - `move_int(int i) -> int`
20
+ - `replace_int(int i, int val)`
21
+ - `zero_int(int len)`
22
+ - `alloc_T(int size) -> int`
23
+ - `grow_T(int needed) -> int`
24
+ - `load_T(int i) -> T`
25
+ - `store_T(int i, T val)`
26
+ - `slice(int start, int end) -> view T`
27
+ - `zero_T(int len)`
28
+ - `store_or_int(int i, int val)`
29
+ - `alloc_float(int size) -> int`
30
+ - `load_float(int i) -> float`
31
+ - `store_float(int i, float val)`
@@ -0,0 +1,10 @@
1
+ # Channel
2
+
3
+ ## `class Channel`
4
+
5
+ A thread-safe, blocking FIFO queue for passing values between tasks
6
+
7
+ **Members:**
8
+
9
+ - `send(uint64 value)`
10
+ - `receive() -> uint64`
@@ -0,0 +1,15 @@
1
+ # ClassBuffer
2
+
3
+ ## `struct ClassBuffer<T>`
4
+
5
+ A flat buffer of owned class pointers of type T — the backing store for collections of classes
6
+
7
+ **Members:**
8
+
9
+ - `alloc_int(int size) -> int`
10
+ - `grow_int(int needed) -> int`
11
+ - `load_int(int i) -> int`
12
+ - `store_int(int i, int val)`
13
+ - `move_int(int i) -> int`
14
+ - `replace_int(int i, int val)`
15
+ - `slice(int start, int end) -> view T`
@@ -0,0 +1,13 @@
1
+ # Console
2
+
3
+ ## `struct Console`
4
+
5
+ The standard console — writing text to, and reading input from, the terminal
6
+
7
+ **Members:**
8
+
9
+ - `write(string line)`
10
+ - `write_line(string line)`
11
+ - `read_line() -> string`
12
+ - `read_char() -> char`
13
+ - `platform() -> string`
@@ -0,0 +1,12 @@
1
+ # Button
2
+
3
+ ## `class Button`
4
+
5
+ A push-button control that triggers an action when clicked
6
+
7
+ **Members:**
8
+
9
+ - `set_frame(int x, int y, int width, int height)`
10
+ - `set_title(string title)`
11
+ - `intrinsic_size() -> Size`
12
+ - `measure(BoxConstraints constraints) -> Size`
@@ -0,0 +1,15 @@
1
+ # CheckBox
2
+
3
+ ## `class CheckBox`
4
+
5
+ A toggle control with a title and checked/hidden state
6
+
7
+ **Members:**
8
+
9
+ - `set_frame(int x, int y, int width, int height)`
10
+ - `set_title(string title)`
11
+ - `set_checked(bool checked)`
12
+ - `is_checked() -> bool`
13
+ - `set_hidden(bool hidden)`
14
+ - `intrinsic_size() -> Size`
15
+ - `measure(BoxConstraints constraints) -> Size`
@@ -0,0 +1,82 @@
1
+ # Container
2
+
3
+ ## `func native_intrinsicnative_intrinsic(uint64 handle) -> _Tuple_int_int`
4
+
5
+ _No documentation._
6
+
7
+ ## `class Container`
8
+
9
+ A flexbox-style container that measures and arranges its child controls.
10
+
11
+ Conforms to `Control`: `measure(BoxConstraints)` measures the whole subtree,
12
+ `set_frame` arranges it into a rectangle, and `intrinsic_size` reports the
13
+ unbounded-content size. The handle-based `add` API and the SoA engine are
14
+ unchanged — the trait methods are thin entry points over the existing math,
15
+ so a `Container` can also be driven polymorphically as a `Control` (passed to
16
+ a `Control`-taking function, stored in a `ClassBuffer<Control>`, etc.).
17
+
18
+ **Members:**
19
+
20
+ - `init_buffers(int cap)`
21
+ - `make_root(int kind, int gap, int col_count)`
22
+ - `first_child(int parent) -> int`
23
+ - `next_sibling(int after, int parent) -> int`
24
+ - `append_node(int parent, int kind, int handle, int gap, int cols, int span, int grow, int shrink, int align) -> int`
25
+ - `root_index() -> int`
26
+ - `add(uint64 handle, int w, int h, int span, int grow, int align, int shrink)`
27
+ - `add_to(int parent, uint64 handle, int w, int h, int span, int grow, int align, int shrink)`
28
+ - `add_kind(uint64 handle, int w_kind, int w_val, int h_kind, int h_val, int span, int grow, int align, int shrink)`
29
+ - `add_to_kind(int parent, uint64 handle, int w_kind, int w_val, int h_kind, int h_val, int span, int grow, int align, int shrink)`
30
+ - `add_len(uint64 handle, LayoutLength w, LayoutLength h, int span, int grow, int align, int shrink)`
31
+ - `add_to_len(int parent, uint64 handle, LayoutLength w, LayoutLength h, int span, int grow, int align, int shrink)`
32
+ - `add_intrinsic(uint64 handle, int span, int grow, int align, int shrink)`
33
+ - `add_to_intrinsic(int parent, uint64 handle, int span, int grow, int align, int shrink)`
34
+ - `set_leaf_size(int idx, int w, int h)`
35
+ - `set_leaf_kind(int idx, int w_kind, int w_val, int h_kind, int h_val)`
36
+ - `add_vstack(int parent, int spacing, int span, int grow, int align, int shrink) -> int`
37
+ - `add_hstack(int parent, int spacing, int span, int grow, int align, int shrink) -> int`
38
+ - `add_spacer(int span, int grow, int shrink, int align)`
39
+ - `add_spacer_to(int parent, int span, int grow, int shrink, int align)`
40
+ - `add_grid(int parent, int cols, int spacing, int span, int grow, int align, int shrink) -> int`
41
+ - `add_zstack(int parent, int span, int grow, int align, int shrink) -> int`
42
+ - `add_block(int padding, int span, int grow, int align, int shrink) -> int`
43
+ - `add_block_to(int parent, int padding, int span, int grow, int align, int shrink) -> int`
44
+ - `measure_node(int idx, int min_w, int max_w, int min_h, int max_h) -> int`
45
+ - `arrange_node(int idx, int x, int y, int w, int h) -> void`
46
+ - `collect_dirty()`
47
+ - `dirty_count() -> int`
48
+ - `dirty_rect(int i) -> string`
49
+ - `mark_dirty(int idx)`
50
+ - `measure_count(int i) -> int`
51
+ - `apply(int content_w, int content_h)`
52
+ - `measure(BoxConstraints constraints) -> Size`
53
+ - `set_frame(int x, int y, int width, int height)`
54
+ - `intrinsic_size() -> Size`
55
+ - `compute(int avail_w, int avail_h)`
56
+ - `layout(Window win)`
57
+ - `set_resize_callback(Window win)`
58
+ - `contains(uint64 handle, int cx, int cy) -> bool`
59
+ - `hit_test(int cx, int cy) -> uint64`
60
+ - `hit_test_index(int cx, int cy) -> int`
61
+ - `hit_test_node(int idx, int cx, int cy) -> int`
62
+ - `fmt_frame(int i) -> string`
63
+
64
+ ## `func nomen_layout_thunknomen_layout_thunk(ref Container grid, Window win)`
65
+
66
+ Entry point the layout engine calls to lay out a Container's tree
67
+
68
+ ## `func VStackVStack(int spacing) -> Container`
69
+
70
+ Creates a vertical stack container with the given spacing
71
+
72
+ ## `func HStackHStack(int spacing) -> Container`
73
+
74
+ Creates a horizontal stack container with the given spacing
75
+
76
+ ## `func ZStackZStack() -> Container`
77
+
78
+ Creates a Z-stack container (children layered on top of one another)
79
+
80
+ ## `func GridGrid(int cols, int spacing) -> Container`
81
+
82
+ Creates a grid container with `cols` columns and the given spacing
@@ -0,0 +1,5 @@
1
+ # Control
2
+
3
+ ## `trait Control`
4
+
5
+ The polymorphic interface every UI node implements (measure / set_frame / intrinsic_size)
@@ -0,0 +1,26 @@
1
+ # Geometry
2
+
3
+ ## `struct Size`
4
+
5
+ A 2D size (width and height)
6
+
7
+ ## `struct Frame`
8
+
9
+ A rectangle (x, y, width, height) — a control's assigned position and size
10
+
11
+ ## `struct Insets`
12
+
13
+ Per-edge padding (top, right, bottom, left)
14
+
15
+ ## `struct BoxConstraints`
16
+
17
+ Min/max size bounds a parent passes to a child during the layout measure phase
18
+
19
+ **Members:**
20
+
21
+ - `tighten_width(int min, int max) -> BoxConstraints`
22
+ - `tighten_height(int min, int max) -> BoxConstraints`
23
+ - `clamp_width(int value) -> int`
24
+ - `clamp_height(int value) -> int`
25
+ - `is_width_bounded() -> bool`
26
+ - `is_height_bounded() -> bool`
@@ -0,0 +1,37 @@
1
+ # Layout
2
+
3
+ ## `struct Layout`
4
+
5
+ A flat, buffer-backed layout tree — nodes stored in parallel arrays for the layout engine
6
+
7
+ ## `func init_layoutinit_layout(ref Layout l, int cap)`
8
+
9
+ Initializes a Layout tree with capacity for `cap` nodes
10
+
11
+ ## `func add_leafadd_leaf(ref Layout l, int parent, int w, int h) -> int`
12
+
13
+ Appends a leaf node (a sized control) under `parent` and returns its index
14
+
15
+ ## `func add_vstackadd_vstack(ref Layout l, int parent, int spacing) -> int`
16
+
17
+ Appends a vertical stack container under `parent` and returns its index
18
+
19
+ ## `func add_hstackadd_hstack(ref Layout l, int parent, int spacing) -> int`
20
+
21
+ Appends a horizontal stack container under `parent` and returns its index
22
+
23
+ ## `func measure_wmeasure_w(Layout l, int count, int idx, int min_w, int max_w, int min_h, int max_h) -> int`
24
+
25
+ Measures node widths against the given constraints (layout measure phase)
26
+
27
+ ## `func arrangearrange(Layout l, int count, int idx, int x, int y, int w, int h) -> void`
28
+
29
+ Assigns concrete frames to nodes (layout arrange phase)
30
+
31
+ ## `func run_layoutrun_layout(ref Layout l, int count, int root, int avail_w, int avail_h)`
32
+
33
+ Runs a full measure-then-arrange pass from `root` within the available space
34
+
35
+ ## `func fmtfmt(Layout l, int idx) -> string`
36
+
37
+ Formats a node and its subtree as a string (for debugging)
@@ -0,0 +1,13 @@
1
+ # LayoutParams
2
+
3
+ ## `enum LayoutLength`
4
+
5
+ How a child dimension is sized: auto (to content), fixed, percent, or fill
6
+
7
+ ## `enum Alignment`
8
+
9
+ How a child is positioned within available space (start / center / end / stretch)
10
+
11
+ ## `struct LayoutParams`
12
+
13
+ Per-child layout preferences: requested dimensions, flex grow/shrink weights, and alignment
@@ -0,0 +1,12 @@
1
+ # Text
2
+
3
+ ## `class Text`
4
+
5
+ A read-only text label control
6
+
7
+ **Members:**
8
+
9
+ - `set_text(string text)`
10
+ - `measure(BoxConstraints constraints) -> Size`
11
+ - `intrinsic_size() -> Size`
12
+ - `set_frame(int x, int y, int width, int height)`
@@ -0,0 +1,13 @@
1
+ # TextBox
2
+
3
+ ## `class TextBox`
4
+
5
+ An editable single-line text input control
6
+
7
+ **Members:**
8
+
9
+ - `set_frame(int x, int y, int width, int height)`
10
+ - `set_text(string text)`
11
+ - `get_text() -> string`
12
+ - `intrinsic_size() -> Size`
13
+ - `measure(BoxConstraints constraints) -> Size`
@@ -0,0 +1,20 @@
1
+ # Window
2
+
3
+ ## `class Window`
4
+
5
+ A top-level native window that hosts controls and dispatches events
6
+
7
+ **Members:**
8
+
9
+ - `show()`
10
+ - `set_title(string title)`
11
+ - `run()`
12
+ - `process_events() -> int`
13
+ - `is_visible() -> bool`
14
+ - `click_x() -> int`
15
+ - `click_y() -> int`
16
+ - `content_width() -> int`
17
+ - `content_height() -> int`
18
+ - `measure(BoxConstraints constraints) -> Size`
19
+ - `intrinsic_size() -> Size`
20
+ - `set_frame(int x, int y, int width, int height)`
@@ -0,0 +1,5 @@
1
+ # Disposable
2
+
3
+ ## `trait Disposable`
4
+
5
+ A trait for resources that must be explicitly cleaned up via `dispose`
@@ -0,0 +1,5 @@
1
+ # Enumerable
2
+
3
+ ## `trait Enumerable`
4
+
5
+ A trait for collections that can be iterated with `for x of collection`
@@ -0,0 +1,17 @@
1
+ # Graph
2
+
3
+ ## `struct Graph<T>`
4
+
5
+ A graph of values connected by edges
6
+
7
+ **Members:**
8
+
9
+ - `add_node(T value)`
10
+ - `add_edge(int from, int to)`
11
+ - `edges_of(int node) -> int`
12
+ - `edge_target(int e) -> int`
13
+ - `next_edge(int e) -> int`
14
+ - `first() -> T`
15
+ - `at(int idx) -> T`
16
+ - `node_length() -> int`
17
+ - `edge_length() -> int`
@@ -0,0 +1,9 @@
1
+ # Init
2
+
3
+ ## `struct Init`
4
+
5
+ Program startup state — the argument count and argument list passed to `main`
6
+
7
+ ## `func parse_intparse_int(string s) -> int`
8
+
9
+ Parses a decimal string into an int
@@ -0,0 +1,16 @@
1
+ # LinkedList
2
+
3
+ ## `struct LinkedList<T>`
4
+
5
+ A doubly-linked list of values
6
+
7
+ **Members:**
8
+
9
+ - `add(T value)`
10
+ - `set_next(int idx, int next)`
11
+ - `set_previous(int idx, int prev)`
12
+ - `next_at(int idx) -> int`
13
+ - `previous_at(int idx) -> int`
14
+ - `first() -> T`
15
+ - `at(int idx) -> T`
16
+ - `length() -> int`
@@ -0,0 +1,13 @@
1
+ # List
2
+
3
+ ## `struct List<T>`
4
+
5
+ A growable, ordered list of values (`push`/`pop`/`at`)
6
+
7
+ **Members:**
8
+
9
+ - `push(T value)`
10
+ - `pop() -> T`
11
+ - `at(int i) -> T`
12
+ - `slice(int start, int end) -> view T`
13
+ - `set(int i, T value)`
@@ -0,0 +1,14 @@
1
+ # Map
2
+
3
+ ## `struct Map<TK, TV>`
4
+
5
+ An ordered key-value map with `set`/`get`/`has`/`remove`
6
+
7
+ **Members:**
8
+
9
+ - `set(TK key, TV value)`
10
+ - `get(TK key) -> TV`
11
+ - `has(TK key) -> bool`
12
+ - `remove(TK key) -> void`
13
+ - `find_slot(TK key, int cap) -> int`
14
+ - `rehash(int new_cap)`
@@ -0,0 +1,11 @@
1
+ # Math
2
+
3
+ ## `struct Math`
4
+
5
+ Mathematical helper functions
6
+
7
+ **Members:**
8
+
9
+ - `power(int base, int exp) -> int`
10
+ - `sqrt(float x) -> float`
11
+ - `log(float x) -> float`
@@ -0,0 +1,10 @@
1
+ # Mutex
2
+
3
+ ## `class Mutex`
4
+
5
+ A pthread-backed mutual-exclusion lock for protecting shared mutable state
6
+
7
+ **Members:**
8
+
9
+ - `lock()`
10
+ - `unlock()`
@@ -0,0 +1,5 @@
1
+ # Nursery
2
+
3
+ ## `struct Nursery`
4
+
5
+ The capability for spawning into a caller's `async` block; owns and tracks its tasks
@@ -0,0 +1,5 @@
1
+ # Sendable
2
+
3
+ ## `trait Sendable`
4
+
5
+ A marker trait for values that are safe to move across task boundaries
@@ -0,0 +1,14 @@
1
+ # Set
2
+
3
+ ## `struct Set<T>`
4
+
5
+ An ordered set of unique values (`add`/`has`/`get`/`remove`)
6
+
7
+ **Members:**
8
+
9
+ - `add(T value)`
10
+ - `has(T value) -> bool`
11
+ - `get(T key) -> T`
12
+ - `remove(T value) -> void`
13
+ - `find_slot(T value, int cap) -> int`
14
+ - `rehash(int new_cap)`
@@ -0,0 +1,12 @@
1
+ # Directory
2
+
3
+ ## `struct Directory`
4
+
5
+ Helpers for working with filesystem directories (`create`/`remove`/`exists`/`list`)
6
+
7
+ **Members:**
8
+
9
+ - `create(string path)`
10
+ - `remove(string path)`
11
+ - `exists(string path) -> bool`
12
+ - `list(string path) -> string`
@@ -0,0 +1,21 @@
1
+ # File
2
+
3
+ ## `struct File`
4
+
5
+ A file handle for reading and writing (`open`/`close`/`readAll`/`writeLine`/…),
6
+ plus static one-shot helpers `exists`, `delete`, `read_all`, `write_all`
7
+
8
+ **Members:**
9
+
10
+ - `open(string path, string mode)`
11
+ - `close()`
12
+ - `readAll() -> string`
13
+ - `writeAll(string data)`
14
+ - `readLine() -> string`
15
+ - `writeLine(string data)`
16
+ - `readChunk(int size) -> string`
17
+ - `writeChunk(string data, int size)`
18
+ - `exists(string path) -> bool`
19
+ - `delete(string path)`
20
+ - `read_all(string path) -> string`
21
+ - `write_all(string path, string data)`
@@ -0,0 +1,14 @@
1
+ # String
2
+
3
+ ## `struct string`
4
+
5
+ A UTF-8 text string — a heap-owned, length-tracked sequence of bytes
6
+
7
+ **Members:**
8
+
9
+ - `to_string() -> string`
10
+ - `at(int index) -> char`
11
+ - `slice(int start, int end) -> view string`
12
+ - `set(int index, char value)`
13
+ - `add(string other) -> string`
14
+ - `mul(int count) -> string`
@@ -0,0 +1,12 @@
1
+ # StringBuilder
2
+
3
+ ## `struct StringBuilder`
4
+
5
+ A growable byte buffer for incrementally building strings (O(1) amortized append)
6
+
7
+ **Members:**
8
+
9
+ - `ensure(int needed)`
10
+ - `append_char(char c)`
11
+ - `append_string(string s)`
12
+ - `to_string() -> string`
@@ -0,0 +1,5 @@
1
+ # Stringable
2
+
3
+ ## `trait Stringable`
4
+
5
+ A trait for values that can be converted to a string via `to_string`
@@ -0,0 +1,15 @@
1
+ # Task
2
+
3
+ ## `class Task<T>`
4
+
5
+ A handle to an asynchronously-running computation, backed by a shared thread pool
6
+
7
+ **Members:**
8
+
9
+ - `wait()`
10
+ - `result() -> T`
11
+ - `result_uint64() -> uint64`
12
+ - `cancel()`
13
+ - `current_cancelled() -> bool`
14
+ - `set_pool_size(int n) -> int`
15
+ - `shutdown_pool()`
@@ -0,0 +1,12 @@
1
+ # Json
2
+
3
+ ## `struct Json`
4
+
5
+ JSON serialization helpers — `serialize`/`deserialize` strings, `parse`/`stringify` via a JsonTree
6
+
7
+ **Members:**
8
+
9
+ - `serialize(string value) -> string`
10
+ - `deserialize(string json) -> string`
11
+ - `parse(string s, ref JsonTree tree) -> int`
12
+ - `stringify(ref JsonTree tree, int root) -> string`
@@ -0,0 +1,21 @@
1
+ # JsonTree
2
+
3
+ ## `struct JsonTree`
4
+
5
+ A flat, buffer-backed pool of JSON tree nodes — the parsed representation `Json.parse` produces
6
+
7
+ **Members:**
8
+
9
+ - `alloc_node() -> int`
10
+ - `free_text(int idx)`
11
+ - `reset()`
12
+ - `set_text(int idx, string text)`
13
+ - `set_kind(int idx, int val)`
14
+ - `set_child(int idx, int val)`
15
+ - `set_next(int idx, int val)`
16
+ - `set_val(int idx, int val)`
17
+ - `get_kind(int idx) -> int`
18
+ - `get_text(int idx) -> string`
19
+ - `get_child(int idx) -> int`
20
+ - `get_next(int idx) -> int`
21
+ - `get_val(int idx) -> int`
@@ -0,0 +1,12 @@
1
+ # Regex
2
+
3
+ ## `struct Regex`
4
+
5
+ Regular-expression helpers (`test`/`match`/`count`/`replace_all`) using POSIX ERE syntax
6
+
7
+ **Members:**
8
+
9
+ - `test(string pattern, string input) -> bool`
10
+ - `match(string pattern, string input) -> string`
11
+ - `count(string pattern, string input) -> int`
12
+ - `replace_all(string pattern, string input, string replacement) -> string`
@@ -0,0 +1,11 @@
1
+ # Time
2
+
3
+ ## `struct Time`
4
+
5
+ Wall-clock time and sleeping (`now_ms`/`now_unix`/`sleep_ms`)
6
+
7
+ **Members:**
8
+
9
+ - `now_ms() -> uint64`
10
+ - `now_unix() -> uint64`
11
+ - `sleep_ms(uint64 ms)`
@@ -0,0 +1,18 @@
1
+ # Tree
2
+
3
+ ## `struct Tree<T>`
4
+
5
+ A tree of values connected by parent/child links
6
+
7
+ **Members:**
8
+
9
+ - `add(T value)`
10
+ - `set_left(int idx, int left)`
11
+ - `set_right(int idx, int right)`
12
+ - `left(int idx) -> int`
13
+ - `right(int idx) -> int`
14
+ - `parent_of(int idx) -> int`
15
+ - `first() -> T`
16
+ - `at(int idx) -> T`
17
+ - `count_nodes(int idx) -> int`
18
+ - `length() -> int`