xbintsc 0.5.6 → 0.5.21

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 (490) hide show
  1. package/AGENTS.md +20 -10
  2. package/README.md +8 -7
  3. package/README.zh-CN.md +6 -6
  4. package/dist/src/binder/declarations.js +14 -3
  5. package/dist/src/binder/declarations.js.map +1 -1
  6. package/dist/src/cli/hints.js +7 -1
  7. package/dist/src/cli/hints.js.map +1 -1
  8. package/dist/src/cli/main.js +115 -15
  9. package/dist/src/cli/main.js.map +1 -1
  10. package/dist/src/cli/watch.d.ts +25 -0
  11. package/dist/src/cli/watch.js +93 -0
  12. package/dist/src/cli/watch.js.map +1 -0
  13. package/dist/src/codegen/generator/calls/access.js +11 -2
  14. package/dist/src/codegen/generator/calls/access.js.map +1 -1
  15. package/dist/src/codegen/generator/calls/closures.js +12 -4
  16. package/dist/src/codegen/generator/calls/closures.js.map +1 -1
  17. package/dist/src/codegen/generator/context.d.ts +8 -0
  18. package/dist/src/codegen/generator/context.js +22 -3
  19. package/dist/src/codegen/generator/context.js.map +1 -1
  20. package/dist/src/codegen/generator/expressions/operators.js +17 -15
  21. package/dist/src/codegen/generator/expressions/operators.js.map +1 -1
  22. package/dist/src/codegen/generator/expressions/primary.js +5 -0
  23. package/dist/src/codegen/generator/expressions/primary.js.map +1 -1
  24. package/dist/src/codegen/generator/module.js +0 -7
  25. package/dist/src/codegen/generator/module.js.map +1 -1
  26. package/dist/src/codegen/generator/numeric.d.ts +6 -3
  27. package/dist/src/codegen/generator/numeric.js +54 -11
  28. package/dist/src/codegen/generator/numeric.js.map +1 -1
  29. package/dist/src/codegen/generator/state.js +23 -0
  30. package/dist/src/codegen/generator/state.js.map +1 -1
  31. package/dist/src/codegen/generator/statements/control-flow.js +1 -4
  32. package/dist/src/codegen/generator/statements/control-flow.js.map +1 -1
  33. package/dist/src/codegen/generator/statements/loops.js +48 -16
  34. package/dist/src/codegen/generator/statements/loops.js.map +1 -1
  35. package/dist/src/codegen/generator/tables.js +26 -1
  36. package/dist/src/codegen/generator/tables.js.map +1 -1
  37. package/dist/src/diagnostics/diagnostic.d.ts +3 -1
  38. package/dist/src/diagnostics/diagnostic.js +23 -3
  39. package/dist/src/diagnostics/diagnostic.js.map +1 -1
  40. package/dist/src/driver/app-artifacts.d.ts +42 -0
  41. package/dist/src/driver/app-artifacts.js +53 -0
  42. package/dist/src/driver/app-artifacts.js.map +1 -0
  43. package/dist/src/driver/build-key.d.ts +29 -0
  44. package/dist/src/driver/build-key.js +35 -0
  45. package/dist/src/driver/build-key.js.map +1 -0
  46. package/dist/src/driver/bundler/graph.js +61 -12
  47. package/dist/src/driver/bundler/graph.js.map +1 -1
  48. package/dist/src/driver/bundler/merge.js +7 -1
  49. package/dist/src/driver/bundler/merge.js.map +1 -1
  50. package/dist/src/driver/compiler.d.ts +10 -67
  51. package/dist/src/driver/compiler.js +95 -234
  52. package/dist/src/driver/compiler.js.map +1 -1
  53. package/dist/src/driver/config.d.ts +3 -0
  54. package/dist/src/driver/config.js +8 -0
  55. package/dist/src/driver/config.js.map +1 -1
  56. package/dist/src/driver/frontend.d.ts +37 -0
  57. package/dist/src/driver/frontend.js +92 -0
  58. package/dist/src/driver/frontend.js.map +1 -0
  59. package/dist/src/driver/index.d.ts +1 -1
  60. package/dist/src/driver/index.js.map +1 -1
  61. package/dist/src/driver/options.d.ts +64 -0
  62. package/dist/src/driver/options.js +9 -0
  63. package/dist/src/driver/options.js.map +1 -0
  64. package/dist/src/driver/runtime-objects.d.ts +38 -0
  65. package/dist/src/driver/runtime-objects.js +112 -0
  66. package/dist/src/driver/runtime-objects.js.map +1 -0
  67. package/dist/src/driver/toolchain-provider.d.ts +4 -0
  68. package/dist/src/driver/toolchain-provider.js +4 -0
  69. package/dist/src/driver/toolchain-provider.js.map +1 -1
  70. package/dist/src/driver/toolchain.d.ts +32 -1
  71. package/dist/src/driver/toolchain.js +115 -11
  72. package/dist/src/driver/toolchain.js.map +1 -1
  73. package/dist/src/driver/version.d.ts +12 -0
  74. package/dist/src/driver/version.js +13 -0
  75. package/dist/src/driver/version.js.map +1 -0
  76. package/dist/src/driver/win-icon.d.ts +7 -9
  77. package/dist/src/driver/win-icon.js +37 -35
  78. package/dist/src/driver/win-icon.js.map +1 -1
  79. package/dist/src/extensions/node/fs/index.d.ts +4 -3
  80. package/dist/src/extensions/node/fs/index.js +12 -3
  81. package/dist/src/extensions/node/fs/index.js.map +1 -1
  82. package/dist/src/extensions/node/fs-promises/index.d.ts +5 -5
  83. package/dist/src/extensions/node/fs-promises/index.js +15 -6
  84. package/dist/src/extensions/node/fs-promises/index.js.map +1 -1
  85. package/dist/src/parser/declarations/classes.js +5 -0
  86. package/dist/src/parser/declarations/classes.js.map +1 -1
  87. package/dist/src/parser/declarations/functions.js +13 -1
  88. package/dist/src/parser/declarations/functions.js.map +1 -1
  89. package/dist/src/parser/modules.js +8 -3
  90. package/dist/src/parser/modules.js.map +1 -1
  91. package/dist/src/parser/parser.d.ts +1 -0
  92. package/dist/src/parser/parser.js +23 -0
  93. package/dist/src/parser/parser.js.map +1 -1
  94. package/dist/tests/cli/check.test.d.ts +6 -0
  95. package/dist/tests/cli/check.test.js +68 -0
  96. package/dist/tests/cli/check.test.js.map +1 -0
  97. package/dist/tests/cli/main.test.js +19 -0
  98. package/dist/tests/cli/main.test.js.map +1 -1
  99. package/dist/tests/cli/watch.test.d.ts +6 -0
  100. package/dist/tests/cli/watch.test.js +72 -0
  101. package/dist/tests/cli/watch.test.js.map +1 -0
  102. package/dist/tests/codegen/expressions.test.js +15 -3
  103. package/dist/tests/codegen/expressions.test.js.map +1 -1
  104. package/dist/tests/codegen/llvm.test.js +16 -0
  105. package/dist/tests/codegen/llvm.test.js.map +1 -1
  106. package/dist/tests/diagnostics/diagnostic.test.js +8 -0
  107. package/dist/tests/diagnostics/diagnostic.test.js.map +1 -1
  108. package/dist/tests/docs/structure.test.d.ts +1 -0
  109. package/dist/tests/docs/structure.test.js +92 -0
  110. package/dist/tests/docs/structure.test.js.map +1 -0
  111. package/dist/tests/driver/compiler.test.js +6 -0
  112. package/dist/tests/driver/compiler.test.js.map +1 -1
  113. package/dist/tests/driver/config.test.js +9 -0
  114. package/dist/tests/driver/config.test.js.map +1 -1
  115. package/dist/tests/driver/icon.test.js +19 -32
  116. package/dist/tests/driver/icon.test.js.map +1 -1
  117. package/dist/tests/driver/invalid-input.test.d.ts +10 -0
  118. package/dist/tests/driver/invalid-input.test.js +29 -0
  119. package/dist/tests/driver/invalid-input.test.js.map +1 -0
  120. package/dist/tests/driver/modules.test.js +42 -3
  121. package/dist/tests/driver/modules.test.js.map +1 -1
  122. package/dist/tests/driver/toolchain-provider.test.js +27 -1
  123. package/dist/tests/driver/toolchain-provider.test.js.map +1 -1
  124. package/dist/tests/driver/toolchain.test.js +60 -2
  125. package/dist/tests/driver/toolchain.test.js.map +1 -1
  126. package/dist/tests/e2e/array-buffer.test.d.ts +5 -0
  127. package/dist/tests/e2e/array-buffer.test.js +38 -0
  128. package/dist/tests/e2e/array-buffer.test.js.map +1 -0
  129. package/dist/tests/e2e/array-from-iterables.test.d.ts +7 -0
  130. package/dist/tests/e2e/array-from-iterables.test.js +34 -0
  131. package/dist/tests/e2e/array-from-iterables.test.js.map +1 -0
  132. package/dist/tests/e2e/array-symbol-iterator.test.d.ts +8 -0
  133. package/dist/tests/e2e/array-symbol-iterator.test.js +42 -0
  134. package/dist/tests/e2e/array-symbol-iterator.test.js.map +1 -0
  135. package/dist/tests/e2e/async-await.test.js +1 -1
  136. package/dist/tests/e2e/async-fs.test.d.ts +9 -0
  137. package/dist/tests/e2e/async-fs.test.js +119 -0
  138. package/dist/tests/e2e/async-fs.test.js.map +1 -0
  139. package/dist/tests/e2e/async-generators.test.d.ts +1 -0
  140. package/dist/tests/e2e/async-generators.test.js +154 -0
  141. package/dist/tests/e2e/async-generators.test.js.map +1 -0
  142. package/dist/tests/e2e/await-ordering.test.d.ts +5 -0
  143. package/dist/tests/e2e/await-ordering.test.js +37 -0
  144. package/dist/tests/e2e/await-ordering.test.js.map +1 -0
  145. package/dist/tests/e2e/compile-builtins.test.js +1 -1
  146. package/dist/tests/e2e/compile-modules.test.js +7 -0
  147. package/dist/tests/e2e/compile-modules.test.js.map +1 -1
  148. package/dist/tests/e2e/date-parse.test.d.ts +8 -0
  149. package/dist/tests/e2e/date-parse.test.js +38 -0
  150. package/dist/tests/e2e/date-parse.test.js.map +1 -0
  151. package/dist/tests/e2e/default-anonymous-exports.test.d.ts +7 -0
  152. package/dist/tests/e2e/default-anonymous-exports.test.js +23 -0
  153. package/dist/tests/e2e/default-anonymous-exports.test.js.map +1 -0
  154. package/dist/tests/e2e/fetch.test.js +24 -0
  155. package/dist/tests/e2e/fetch.test.js.map +1 -1
  156. package/dist/tests/e2e/globals-microtask.test.d.ts +9 -0
  157. package/dist/tests/e2e/globals-microtask.test.js +37 -0
  158. package/dist/tests/e2e/globals-microtask.test.js.map +1 -0
  159. package/dist/tests/e2e/gui-inline-svg.test.d.ts +11 -0
  160. package/dist/tests/e2e/gui-inline-svg.test.js +160 -0
  161. package/dist/tests/e2e/gui-inline-svg.test.js.map +1 -0
  162. package/dist/tests/e2e/gui-media.test.js +8 -1
  163. package/dist/tests/e2e/gui-media.test.js.map +1 -1
  164. package/dist/tests/e2e/inspect-builtins.test.d.ts +10 -0
  165. package/dist/tests/e2e/inspect-builtins.test.js +43 -0
  166. package/dist/tests/e2e/inspect-builtins.test.js.map +1 -0
  167. package/dist/tests/e2e/json-builtin-objects.test.d.ts +9 -0
  168. package/dist/tests/e2e/json-builtin-objects.test.js +23 -0
  169. package/dist/tests/e2e/json-builtin-objects.test.js.map +1 -0
  170. package/dist/tests/e2e/json-circular.test.d.ts +6 -0
  171. package/dist/tests/e2e/json-circular.test.js +43 -0
  172. package/dist/tests/e2e/json-circular.test.js.map +1 -0
  173. package/dist/tests/e2e/json-parse-reviver.test.d.ts +6 -0
  174. package/dist/tests/e2e/json-parse-reviver.test.js +29 -0
  175. package/dist/tests/e2e/json-parse-reviver.test.js.map +1 -0
  176. package/dist/tests/e2e/json-stringify-replacer.test.d.ts +6 -0
  177. package/dist/tests/e2e/json-stringify-replacer.test.js +27 -0
  178. package/dist/tests/e2e/json-stringify-replacer.test.js.map +1 -0
  179. package/dist/tests/e2e/json-stringify-space.test.d.ts +6 -0
  180. package/dist/tests/e2e/json-stringify-space.test.js +23 -0
  181. package/dist/tests/e2e/json-stringify-space.test.js.map +1 -0
  182. package/dist/tests/e2e/method-dispatch-errors.test.d.ts +9 -0
  183. package/dist/tests/e2e/method-dispatch-errors.test.js +38 -0
  184. package/dist/tests/e2e/method-dispatch-errors.test.js.map +1 -0
  185. package/dist/tests/e2e/native-extensions.test.js +1 -1
  186. package/dist/tests/e2e/native-extensions.test.js.map +1 -1
  187. package/dist/tests/e2e/promise-with-resolvers.test.d.ts +5 -0
  188. package/dist/tests/e2e/promise-with-resolvers.test.js +20 -0
  189. package/dist/tests/e2e/promise-with-resolvers.test.js.map +1 -0
  190. package/dist/tests/e2e/property-descriptors.test.d.ts +5 -0
  191. package/dist/tests/e2e/property-descriptors.test.js +25 -0
  192. package/dist/tests/e2e/property-descriptors.test.js.map +1 -0
  193. package/dist/tests/e2e/property-ic.test.d.ts +1 -0
  194. package/dist/tests/e2e/property-ic.test.js +55 -0
  195. package/dist/tests/e2e/property-ic.test.js.map +1 -0
  196. package/dist/tests/e2e/runtime-errors.test.d.ts +10 -0
  197. package/dist/tests/e2e/runtime-errors.test.js +52 -0
  198. package/dist/tests/e2e/runtime-errors.test.js.map +1 -0
  199. package/dist/tests/e2e/structured-clone.test.d.ts +6 -0
  200. package/dist/tests/e2e/structured-clone.test.js +49 -0
  201. package/dist/tests/e2e/structured-clone.test.js.map +1 -0
  202. package/dist/tests/e2e/text-codec.test.d.ts +6 -0
  203. package/dist/tests/e2e/text-codec.test.js +24 -0
  204. package/dist/tests/e2e/text-codec.test.js.map +1 -0
  205. package/dist/tests/e2e/typed-array-views.test.d.ts +6 -0
  206. package/dist/tests/e2e/typed-array-views.test.js +39 -0
  207. package/dist/tests/e2e/typed-array-views.test.js.map +1 -0
  208. package/dist/tests/e2e/url-search-params.test.d.ts +5 -0
  209. package/dist/tests/e2e/url-search-params.test.js +30 -0
  210. package/dist/tests/e2e/url-search-params.test.js.map +1 -0
  211. package/dist/tests/e2e/weak-collections.test.d.ts +1 -0
  212. package/dist/tests/e2e/weak-collections.test.js +88 -0
  213. package/dist/tests/e2e/weak-collections.test.js.map +1 -0
  214. package/dist/tests/parser/declarations.test.js +12 -0
  215. package/dist/tests/parser/declarations.test.js.map +1 -1
  216. package/dist/tests/parser/module-syntax.test.js +9 -0
  217. package/dist/tests/parser/module-syntax.test.js.map +1 -1
  218. package/dist/tests/parser/parser.test.js +7 -0
  219. package/dist/tests/parser/parser.test.js.map +1 -1
  220. package/dist/tests/version.test.js +5 -1
  221. package/dist/tests/version.test.js.map +1 -1
  222. package/doc/ai/README.md +4 -3
  223. package/doc/ai/cli.md +41 -0
  224. package/doc/ai/contributing.md +20 -16
  225. package/doc/ai/extensions.md +13 -10
  226. package/doc/ai/language-support.md +19 -14
  227. package/doc/ai/troubleshooting.md +11 -9
  228. package/doc/ai/zh-CN/README.md +3 -2
  229. package/doc/ai/zh-CN/cli.md +35 -0
  230. package/doc/ai/zh-CN/contributing.md +16 -15
  231. package/doc/ai/zh-CN/extensions.md +12 -9
  232. package/doc/ai/zh-CN/language-support.md +19 -15
  233. package/doc/ai/zh-CN/troubleshooting.md +9 -8
  234. package/doc/gui/api.md +8 -0
  235. package/doc/gui/build.md +13 -4
  236. package/doc/gui/known-issues.md +19 -14
  237. package/doc/gui/media.md +32 -3
  238. package/doc/gui/rendering.md +3 -1
  239. package/doc/gui.md +28 -5
  240. package/doc/icon.md +5 -4
  241. package/doc/implemented/async.md +51 -0
  242. package/doc/implemented/binder.md +13 -0
  243. package/doc/implemented/cli.md +47 -0
  244. package/doc/implemented/codegen.md +33 -0
  245. package/doc/implemented/collections.md +26 -0
  246. package/doc/implemented/driver.md +19 -0
  247. package/doc/implemented/extensions.md +19 -0
  248. package/doc/implemented/fetch.md +44 -0
  249. package/doc/implemented/lexer.md +23 -0
  250. package/doc/implemented/modules.md +28 -0
  251. package/doc/implemented/node/assert.md +17 -0
  252. package/doc/implemented/node/buffer.md +29 -0
  253. package/doc/implemented/node/child-process.md +29 -0
  254. package/doc/implemented/node/crypto.md +9 -0
  255. package/doc/implemented/node/dgram.md +15 -0
  256. package/doc/implemented/node/events.md +37 -0
  257. package/doc/implemented/node/fs-promises.md +49 -0
  258. package/doc/implemented/node/fs.md +112 -0
  259. package/doc/implemented/node/http.md +21 -0
  260. package/doc/implemented/node/net.md +17 -0
  261. package/doc/implemented/node/os.md +22 -0
  262. package/doc/implemented/node/path.md +33 -0
  263. package/doc/implemented/node/process.md +23 -0
  264. package/doc/implemented/node/querystring.md +20 -0
  265. package/doc/implemented/node/stream-promises.md +8 -0
  266. package/doc/implemented/node/stream.md +19 -0
  267. package/doc/implemented/node/test.md +10 -0
  268. package/doc/implemented/node/url.md +8 -0
  269. package/doc/implemented/node/util.md +25 -0
  270. package/doc/implemented/node/worker-threads.md +10 -0
  271. package/doc/implemented/node/zlib.md +8 -0
  272. package/doc/implemented/node.md +48 -0
  273. package/doc/implemented/operators.md +38 -0
  274. package/doc/implemented/parser.md +58 -0
  275. package/doc/implemented/pipeline.md +28 -0
  276. package/doc/implemented/runtime-core.md +32 -0
  277. package/doc/implemented/stdlib.md +78 -0
  278. package/doc/implemented/strings.md +27 -0
  279. package/doc/implemented/tests.md +10 -0
  280. package/doc/implemented/typed-arrays.md +26 -0
  281. package/doc/implemented/value-model.md +18 -0
  282. package/doc/implemented.md +54 -355
  283. package/doc/node-implemented.md +3 -585
  284. package/doc/node-unimplemented.md +3 -164
  285. package/doc/requirements.md +23 -8
  286. package/doc/unimplemented/classes.md +22 -0
  287. package/doc/unimplemented/deviations.md +27 -0
  288. package/doc/unimplemented/expressions.md +26 -0
  289. package/doc/unimplemented/functions.md +21 -0
  290. package/doc/unimplemented/modules.md +22 -0
  291. package/doc/unimplemented/node/async.md +20 -0
  292. package/doc/unimplemented/node/bun.md +9 -0
  293. package/doc/unimplemented/node/fs-promises.md +20 -0
  294. package/doc/unimplemented/node/fs.md +30 -0
  295. package/doc/unimplemented/node/globals.md +23 -0
  296. package/doc/unimplemented/node/modules.md +21 -0
  297. package/doc/unimplemented/node.md +21 -0
  298. package/doc/unimplemented/statements.md +18 -0
  299. package/doc/unimplemented/stdlib.md +54 -0
  300. package/doc/unimplemented/toolchain.md +14 -0
  301. package/doc/unimplemented/types.md +12 -0
  302. package/doc/unimplemented.md +18 -275
  303. package/doc/xbintsc.config.schema.json +12 -0
  304. package/doc/zh-CN/gui/api.md +7 -0
  305. package/doc/zh-CN/gui/build.md +11 -3
  306. package/doc/zh-CN/gui/known-issues.md +17 -11
  307. package/doc/zh-CN/gui/media.md +26 -2
  308. package/doc/zh-CN/gui/rendering.md +2 -1
  309. package/doc/zh-CN/gui.md +21 -3
  310. package/doc/zh-CN/icon.md +5 -4
  311. package/doc/zh-CN/implemented/async.md +49 -0
  312. package/doc/zh-CN/implemented/binder.md +13 -0
  313. package/doc/zh-CN/implemented/cli.md +46 -0
  314. package/doc/zh-CN/implemented/codegen.md +33 -0
  315. package/doc/zh-CN/implemented/collections.md +26 -0
  316. package/doc/zh-CN/implemented/driver.md +19 -0
  317. package/doc/zh-CN/implemented/extensions.md +19 -0
  318. package/doc/zh-CN/implemented/fetch.md +31 -0
  319. package/doc/zh-CN/implemented/lexer.md +23 -0
  320. package/doc/zh-CN/implemented/modules.md +28 -0
  321. package/doc/zh-CN/implemented/node/assert.md +17 -0
  322. package/doc/zh-CN/implemented/node/buffer.md +25 -0
  323. package/doc/zh-CN/implemented/node/child-process.md +27 -0
  324. package/doc/zh-CN/implemented/node/crypto.md +9 -0
  325. package/doc/zh-CN/implemented/node/dgram.md +15 -0
  326. package/doc/zh-CN/implemented/node/events.md +36 -0
  327. package/doc/zh-CN/implemented/node/fs-promises.md +30 -0
  328. package/doc/zh-CN/implemented/node/fs.md +105 -0
  329. package/doc/zh-CN/implemented/node/http.md +17 -0
  330. package/doc/zh-CN/implemented/node/net.md +17 -0
  331. package/doc/zh-CN/implemented/node/os.md +21 -0
  332. package/doc/zh-CN/implemented/node/path.md +26 -0
  333. package/doc/zh-CN/implemented/node/process.md +23 -0
  334. package/doc/zh-CN/implemented/node/querystring.md +20 -0
  335. package/doc/zh-CN/implemented/node/stream-promises.md +8 -0
  336. package/doc/zh-CN/implemented/node/stream.md +15 -0
  337. package/doc/zh-CN/implemented/node/test.md +10 -0
  338. package/doc/zh-CN/implemented/node/url.md +8 -0
  339. package/doc/zh-CN/implemented/node/util.md +25 -0
  340. package/doc/zh-CN/implemented/node/worker-threads.md +9 -0
  341. package/doc/zh-CN/implemented/node/zlib.md +8 -0
  342. package/doc/zh-CN/implemented/node.md +45 -0
  343. package/doc/zh-CN/implemented/operators.md +38 -0
  344. package/doc/zh-CN/implemented/parser.md +58 -0
  345. package/doc/zh-CN/implemented/pipeline.md +25 -0
  346. package/doc/zh-CN/implemented/runtime-core.md +31 -0
  347. package/doc/zh-CN/implemented/stdlib.md +76 -0
  348. package/doc/zh-CN/implemented/strings.md +27 -0
  349. package/doc/zh-CN/implemented/tests.md +10 -0
  350. package/doc/zh-CN/implemented/typed-arrays.md +26 -0
  351. package/doc/zh-CN/implemented/value-model.md +18 -0
  352. package/doc/zh-CN/implemented.md +50 -350
  353. package/doc/zh-CN/node-implemented.md +4 -531
  354. package/doc/zh-CN/node-unimplemented.md +4 -139
  355. package/doc/zh-CN/plan-require-node-modules.md +4 -4
  356. package/doc/zh-CN/requirements.md +20 -6
  357. package/doc/zh-CN/unimplemented/classes.md +22 -0
  358. package/doc/zh-CN/unimplemented/deviations.md +24 -0
  359. package/doc/zh-CN/unimplemented/expressions.md +24 -0
  360. package/doc/zh-CN/unimplemented/functions.md +21 -0
  361. package/doc/zh-CN/unimplemented/modules.md +19 -0
  362. package/doc/zh-CN/unimplemented/node/async.md +20 -0
  363. package/doc/zh-CN/unimplemented/node/bun.md +8 -0
  364. package/doc/zh-CN/unimplemented/node/fs-promises.md +12 -0
  365. package/doc/zh-CN/unimplemented/node/fs.md +24 -0
  366. package/doc/zh-CN/unimplemented/node/globals.md +14 -0
  367. package/doc/zh-CN/unimplemented/node/modules.md +15 -0
  368. package/doc/zh-CN/unimplemented/node.md +18 -0
  369. package/doc/zh-CN/unimplemented/statements.md +15 -0
  370. package/doc/zh-CN/unimplemented/stdlib.md +54 -0
  371. package/doc/zh-CN/unimplemented/toolchain.md +14 -0
  372. package/doc/zh-CN/unimplemented/types.md +11 -0
  373. package/doc/zh-CN/unimplemented.md +14 -237
  374. package/llms.txt +32 -4
  375. package/package.json +1 -1
  376. package/runtime/ext_gui/inline_svg.cpp +219 -0
  377. package/runtime/ext_gui/inline_svg.h +41 -0
  378. package/runtime/ext_gui/layout.cpp +18 -0
  379. package/runtime/ext_gui/layout.h +7 -0
  380. package/runtime/ext_gui/layout_flow.cpp +4 -3
  381. package/runtime/ext_gui/paint.cpp +14 -0
  382. package/runtime/ext_gui/paint.h +5 -1
  383. package/runtime/ext_gui/renderer_image.cpp +53 -25
  384. package/runtime/ext_gui/renderer_shaders.h +2 -2
  385. package/runtime/ext_gui/stb_image.h +1 -17
  386. package/runtime/ext_gui/style_ua.cpp +3 -0
  387. package/runtime/ext_gui/svg.cpp +122 -39
  388. package/runtime/ext_gui/svg.h +14 -3
  389. package/runtime/ext_gui/window.cpp +28 -0
  390. package/runtime/ext_node/child_process/child_process.c +173 -73
  391. package/runtime/ext_node/fs/async_api.c +314 -0
  392. package/runtime/ext_node/fs/async_complete.c +99 -0
  393. package/runtime/ext_node/fs/async_fh.c +206 -0
  394. package/runtime/ext_node/fs/async_job.c +81 -0
  395. package/runtime/ext_node/fs/async_job.h +132 -0
  396. package/runtime/ext_node/fs/async_worker.c +534 -0
  397. package/runtime/ext_node/fs/async_worker_dir.c +439 -0
  398. package/runtime/ext_node/fs/async_worker_dir.h +33 -0
  399. package/runtime/ext_node/fs/async_worker_fd.c +74 -0
  400. package/runtime/ext_node/fs/dir.c +60 -15
  401. package/runtime/ext_node/fs/fs_common.h +9 -0
  402. package/runtime/ext_node/fs/fs_ops.c +18 -29
  403. package/runtime/ext_node/fs/parts/builtins.inc +34 -0
  404. package/runtime/ext_node/fs/parts/platform.inc +66 -0
  405. package/runtime/ext_node/fs/promises.c +44 -234
  406. package/runtime/rt.h +15 -0
  407. package/runtime/rt_internal.h +108 -0
  408. package/runtime/xt_alloc.c +43 -7
  409. package/runtime/xt_array_buffer.c +284 -0
  410. package/runtime/xt_async.c +46 -21
  411. package/runtime/xt_async_io.c +333 -0
  412. package/runtime/xt_async_io.h +47 -0
  413. package/runtime/xt_bigint/helpers.inc +3 -3
  414. package/runtime/xt_builtins.c +21 -17
  415. package/runtime/xt_constructors.c +12 -2
  416. package/runtime/xt_containers/access.inc +148 -3
  417. package/runtime/xt_containers/objects.inc +26 -2
  418. package/runtime/xt_containers/shapes.inc +71 -0
  419. package/runtime/xt_containers.c +1 -0
  420. package/runtime/xt_coroutine.c +17 -0
  421. package/runtime/xt_fetch/async.inc +295 -0
  422. package/runtime/xt_fetch/request.inc +6 -183
  423. package/runtime/xt_fetch/socket.inc +5 -4
  424. package/runtime/xt_fetch.c +6 -4
  425. package/runtime/xt_generator.c +299 -10
  426. package/runtime/xt_io/inspect.inc +112 -0
  427. package/runtime/xt_loop.c +79 -7
  428. package/runtime/xt_performance.c +37 -0
  429. package/runtime/xt_promise.c +63 -1
  430. package/runtime/xt_stdlib/arrays.inc +1 -1
  431. package/runtime/xt_stdlib/dispatch.inc +46 -11
  432. package/runtime/xt_stdlib/strings.inc +1 -1
  433. package/runtime/xt_stdlib2/array-statics.inc +25 -0
  434. package/runtime/xt_stdlib2/arrays.inc +5 -3
  435. package/runtime/xt_stdlib2/container.inc +5 -0
  436. package/runtime/xt_stdlib2/date.inc +111 -3
  437. package/runtime/xt_stdlib2/error.inc +24 -0
  438. package/runtime/xt_stdlib2/json.inc +310 -19
  439. package/runtime/xt_stdlib2/number-string-statics.inc +1 -1
  440. package/runtime/xt_stdlib2/objects.inc +122 -0
  441. package/runtime/xt_stdlib2/set.inc +1 -1
  442. package/runtime/xt_structured_clone.c +159 -0
  443. package/runtime/xt_symbol.c +2 -2
  444. package/runtime/xt_text_codec.c +69 -0
  445. package/runtime/xt_typed_array/construction.inc +35 -5
  446. package/runtime/xt_typed_array/elements.inc +159 -0
  447. package/runtime/xt_typed_array/methods.inc +21 -5
  448. package/runtime/xt_typed_array.c +7 -10
  449. package/runtime/xt_url.c +375 -0
  450. package/runtime/xt_values/arithmetic.inc +2 -2
  451. package/runtime/xt_values/conversions.inc +1 -1
  452. package/runtime/xt_weak.c +281 -0
  453. package/scripts/build-gui.ts +133 -60
  454. package/scripts/check-version.ts +3 -3
  455. package/src/binder/declarations.ts +14 -3
  456. package/src/cli/hints.ts +8 -1
  457. package/src/cli/main.ts +119 -18
  458. package/src/cli/watch.ts +101 -0
  459. package/src/codegen/generator/calls/access.ts +10 -2
  460. package/src/codegen/generator/calls/closures.ts +12 -4
  461. package/src/codegen/generator/context.ts +23 -3
  462. package/src/codegen/generator/expressions/operators.ts +27 -13
  463. package/src/codegen/generator/expressions/primary.ts +4 -0
  464. package/src/codegen/generator/module.ts +0 -7
  465. package/src/codegen/generator/numeric.ts +85 -11
  466. package/src/codegen/generator/state.ts +23 -0
  467. package/src/codegen/generator/statements/control-flow.ts +1 -4
  468. package/src/codegen/generator/statements/loops.ts +50 -16
  469. package/src/codegen/generator/tables.ts +26 -1
  470. package/src/diagnostics/diagnostic.ts +23 -3
  471. package/src/driver/app-artifacts.ts +77 -0
  472. package/src/driver/build-key.ts +55 -0
  473. package/src/driver/bundler/graph.ts +63 -13
  474. package/src/driver/bundler/merge.ts +4 -1
  475. package/src/driver/compiler.ts +94 -328
  476. package/src/driver/config.ts +11 -0
  477. package/src/driver/frontend.ts +120 -0
  478. package/src/driver/index.ts +0 -1
  479. package/src/driver/options.ts +70 -0
  480. package/src/driver/runtime-objects.ts +134 -0
  481. package/src/driver/toolchain-provider.ts +4 -0
  482. package/src/driver/toolchain.ts +154 -10
  483. package/src/driver/version.ts +12 -0
  484. package/src/driver/win-icon.ts +36 -36
  485. package/src/extensions/node/fs/index.ts +12 -3
  486. package/src/extensions/node/fs-promises/index.ts +15 -6
  487. package/src/parser/declarations/classes.ts +4 -0
  488. package/src/parser/declarations/functions.ts +12 -1
  489. package/src/parser/modules.ts +8 -4
  490. package/src/parser/parser.ts +28 -0
@@ -0,0 +1,25 @@
1
+ # `util`
2
+
3
+ > Part of [Node extension: implemented](../node.md) · [简体中文](../../zh-CN/implemented/node/util.md)
4
+
5
+ Location: `src/extensions/node/util/index.ts`, `runtime/ext_node/util/util.c`
6
+
7
+ Both named imports (`import { format } from "util"`) and namespace calls
8
+ (`import util from "util"` / `import * as util from "util"`) are supported.
9
+
10
+ | Function | Notes |
11
+ | --- | --- |
12
+ | `format(fmt, ...args)` | `%s` `%d` `%i` `%f` `%j` `%o` `%O` `%c` `%%` placeholders |
13
+ | `formatWithOptions(opts, fmt, ...args)` | options accepted and ignored |
14
+ | `inspect(value)` | recursive printer (depth-limited, strings quoted) |
15
+ | `isDeepStrictEqual(a, b)` | structural comparison (`NaN` equals `NaN`) |
16
+ | `inherits(ctor, superCtor)` | prototype wiring |
17
+ | `deprecate(fn, msg)` | returns `fn` unchanged (there is no warning channel) |
18
+ | `promisify(fn)` | wraps a trailing-callback function into a `Promise` |
19
+ | `isString` `isNumber` `isBoolean` `isUndefined` `isNull` `isFunction` `isArray` `isObject` `isBuffer` `isDate` `isRegExp` `isPromise` `isError` | type predicates |
20
+
21
+ ```ts
22
+ import { format, promisify } from "util";
23
+
24
+ console.log(format("%s=%d", "n", 3)); // n=3
25
+ ```
@@ -0,0 +1,10 @@
1
+ # `worker_threads`
2
+
3
+ > Part of [Node extension: implemented](../node.md) · [简体中文](../../zh-CN/implemented/node/worker-threads.md)
4
+
5
+ Location: `src/extensions/node/worker_threads/index.ts`, `runtime/ext_node/worker_threads/worker_threads.c`
6
+
7
+ - `Worker`, `isMainThread`, `workerData`, `parentPort`.
8
+ - xbintsc emulates a worker by re-running the current executable as a child
9
+ process; `isMainThread` / `workerData` / `parentPort` are value bindings
10
+ (nullary runtime getters) and `Worker` is a constructor.
@@ -0,0 +1,8 @@
1
+ # `zlib`
2
+
3
+ > Part of [Node extension: implemented](../node.md) · [简体中文](../../zh-CN/implemented/node/zlib.md)
4
+
5
+ Location: `src/extensions/node/zlib/index.ts`, `runtime/ext_node/zlib/zlib.c`
6
+
7
+ - Only `createGzip()` is implemented. It returns a gzip transform consumed by
8
+ [`stream/promises`](./stream-promises.md) `pipeline`.
@@ -0,0 +1,48 @@
1
+ # Node extension: implemented
2
+
3
+ > Part of [Implemented syntax and features](../implemented.md) · [简体中文](../zh-CN/implemented/node.md)
4
+
5
+ Location: `src/extensions/node/`, `runtime/ext_node/`
6
+
7
+ The `node` extension is optional: enable it with `--ext node` (or
8
+ `"extensions": ["node"]` in `xbintsc.config.json`). It is a platform extension:
9
+ one subdirectory per Node module, pairing the TypeScript exports with the C
10
+ implementation. Adding a module does not change the core compiler; the extension
11
+ contract is described in [Extension mechanism](./extensions.md).
12
+
13
+ Every module has its own page so a change to one module does not collide with
14
+ work on another. Missing or different behaviour is recorded under
15
+ [Node extension: unimplemented](../unimplemented/node.md).
16
+
17
+ ## Modules
18
+
19
+ | Module | Page | Notes |
20
+ | --- | --- | --- |
21
+ | `fs` | [fs](./node/fs.md) | synchronous API only |
22
+ | `fs/promises` | [fs/promises](./node/fs-promises.md) | reactor-driven file and `FileHandle` operations on the async I/O pool |
23
+ | `path` | [path](./node/path.md) | `path.<name>(...)` namespace calls |
24
+ | `os` | [os](./node/os.md) | `os.<name>(...)` namespace calls |
25
+ | `process` | [process](./node/process.md) | object: methods and properties |
26
+ | `buffer` | [buffer](./node/buffer.md) | `Buffer` represented as a plain object |
27
+ | `stream` | [stream](./node/stream.md) | `Readable` / `Writable` / `Duplex` / `Transform` / `PassThrough` |
28
+ | `stream/promises` | [stream/promises](./node/stream-promises.md) | `pipeline` only |
29
+ | `net` | [net](./node/net.md) | TCP server and client |
30
+ | `dgram` | [dgram](./node/dgram.md) | UDP sockets |
31
+ | `http` | [http](./node/http.md) | server and client, `Connection: close` |
32
+ | `child_process` | [child_process](./node/child-process.md) | `spawnSync` only |
33
+ | `events` | [events](./node/events.md) | `EventEmitter` (global and named export) |
34
+ | `util` | [util](./node/util.md) | formatting, inspection and predicates |
35
+ | `querystring` | [querystring](./node/querystring.md) | parse / stringify / escape |
36
+ | `assert` | [assert](./node/assert.md) | assertion functions |
37
+ | `test` | [test](./node/test.md) | minimal TAP runner |
38
+ | `crypto` | [crypto](./node/crypto.md) | `createHash` (SHA-1 / SHA-256) |
39
+ | `url` | [url](./node/url.md) | `pathToFileURL` / `fileURLToPath` |
40
+ | `zlib` | [zlib](./node/zlib.md) | `createGzip` only |
41
+ | `worker_threads` | [worker_threads](./node/worker-threads.md) | emulated with child processes |
42
+
43
+ ## Where does a change belong?
44
+
45
+ A Node module change normally touches `src/extensions/node/<module>/` and
46
+ `runtime/ext_node/<module>/`; document it in `node/<module>.md` and, if it
47
+ changes a limitation, in the matching page under
48
+ `../../unimplemented/node/`. The compiler core does not change.
@@ -0,0 +1,38 @@
1
+ # Operators and assignment
2
+
3
+ > Part of [Implemented syntax and features](../implemented.md) · [简体中文](../zh-CN/implemented/operators.md)
4
+
5
+ Location: `src/codegen/llvm.ts` (`BINARY_RUNTIME`, `emitPrefix`, `emitPostfix`, `emitAssignment`)
6
+
7
+ ## Arithmetic
8
+
9
+ `+ - * / % **` (`**` is right-associative)
10
+
11
+ ## Comparison and equality
12
+
13
+ `< <= > >=`, `== !=` (loose equality), `=== !==` (strict equality)
14
+
15
+ ## Logical and short-circuit
16
+
17
+ `&& || ??` (with short-circuit evaluation), `!`
18
+
19
+ ## Bitwise
20
+
21
+ `& | ^ ~ << >> >>>`
22
+
23
+ ## Unary
24
+
25
+ `+ - ! ~`, prefix / postfix `++ --`
26
+
27
+ ## Assignment
28
+
29
+ `= += -= *= /= %= **= <<= >>= >>>= &= |= ^= &&= ||= ??=`
30
+
31
+ ## Other expression operators
32
+
33
+ - Comma expression `,`
34
+ - `in` operator (`key in obj`, mapped to `xt_in`)
35
+ - `delete obj.key` / `delete obj[key]` (mapped to `xt_delete`)
36
+ - `instanceof` (mapped to `xt_instance_of`, walking the prototype chain)
37
+
38
+ > `typeof` / `void` are implemented as unary operators.
@@ -0,0 +1,58 @@
1
+ # Parser
2
+
3
+ > Part of [Implemented syntax and features](../implemented.md) · [简体中文](../zh-CN/implemented/parser.md)
4
+
5
+ Location: `src/parser/parser.ts`, `src/ast/nodes.ts`
6
+
7
+ Module syntax (`import` / `export`, import attributes) and the driver-level bundling that gives it runtime meaning are covered in [Module system](./modules.md).
8
+
9
+ ## Statements
10
+
11
+ - Variable declarations: `var` / `let` / `const`, with multiple declarators `const a = 1, b = 2;`
12
+ - Function declarations, function expressions and methods, including the `async` modifier, generators (`function*`, `yield`, `yield*`, `.next`/`.throw`/`.return`) and async generators (`async function*`, `for await...of`)
13
+ - `class` declarations / class expressions (constructor, fields, methods, `static`, `extends`)
14
+ - `if` / `else`
15
+ - `while`, `do...while`
16
+ - `for` (init, condition and increment may all be omitted)
17
+ - `for...of`, `for...in`
18
+ - `return`, `break`, `continue`, `throw` (including labeled `break label` / `continue label`)
19
+ - `switch` / `case` / `default` (including fall-through)
20
+ - `try` / `catch` / `finally` (catchable exceptions based on a runtime setjmp frame)
21
+ - `export var` / `export let` / `export const` (modifier parsed then erased)
22
+ - Block statement `{}`, empty statement `;`, `debugger;`
23
+ - Expression statements
24
+
25
+ ## Expressions
26
+
27
+ - All common operators with precedence / associativity (see [Operators](./operators.md))
28
+ - Assignment expressions and all compound assignments (see [Operators](./operators.md))
29
+ - Conditional (ternary) expressions `a ? b : c`
30
+ - Arrow functions `() => expr` / `() => { ... }` (including type parameters and return type annotations)
31
+ - Function expressions `function () {}` and named function expressions `function g() {}`
32
+ - Call expressions `f(...)`, member access `a.b`, element access `a[i]`
33
+ - Array literals `[1, 2]`, sparse array elision, spread `[...a]` (also over strings, `Map` and `Set`)
34
+ - Object literals `{ a: 1 }`, shorthand properties `{ a }`, method shorthand `{ m() {} }`, getter / setter shorthand `{ get x() {} }` / `{ set x(v) {} }`, computed keys `{ [expr]: 1 }`, object spread `{ ...obj }`
35
+ - Template literal `${}` substitutions, tagged templates (with raw strings and `String.raw`)
36
+ - Parenthesized expressions, `as` / `satisfies` / non-null assertion `!` (type erasure)
37
+ - Unary: `+ - ! ~ typeof void`, prefix / postfix `++ --`
38
+ - Optional chaining `?.` / `?.[]` / `?.()` (with nullish short-circuit semantics)
39
+ - `delete` expressions (delete an object property)
40
+
41
+ ## TypeScript type syntax (parsed only, structure preserved then erased)
42
+
43
+ - Type annotations, return type annotations, type parameters `<T>` and constraints `<T extends U>`, type parameter defaults
44
+ - Type references, qualified names `A.B`
45
+ - Unions `|`, intersections `&`, arrays `T[]`, tuples `[T, U]`, optional tuple members `T?`, rest tuple members `...T`
46
+ - Function types `(a: T) => U`, construct signatures `new () => T`
47
+ - Object type literals, property signatures, method signatures, index signatures `[k: string]: T`
48
+ - Conditional types `T extends U ? X : Y`, mapped types `{ [K in T]: U }`, `infer`
49
+ - Type operators `keyof`, `unique`, `readonly`
50
+ - `typeof` (type query), indexed access types `T[K]`
51
+ - Literal types, `this` types
52
+ - Type predicates `x is T` / `asserts x is T`
53
+ - Interfaces, type aliases, enums, namespace / module declarations
54
+ - The various forms of `import` / `export` (structural parsing)
55
+
56
+ ## ASI
57
+
58
+ - Automatic Semicolon Insertion, based on `precededByLineBreak` / `}` / EOF.
@@ -0,0 +1,28 @@
1
+ # Compilation pipeline
2
+
3
+ > Part of [Implemented syntax and features](../implemented.md) · [简体中文](../zh-CN/implemented/pipeline.md)
4
+
5
+ ```
6
+ source.ts
7
+ │ lexer src/lexer/scanner.ts + token.ts
8
+ ▼
9
+ tokens
10
+ │ parser src/parser/parser.ts → AST src/ast/
11
+ ▼
12
+ AST
13
+ │ binder src/binder/binder.ts → scopes/symbols/closure capture
14
+ ▼
15
+ bound AST
16
+ │ codegen src/codegen/llvm.ts + values.ts → LLVM IR text
17
+ ▼
18
+ module.ll ── clang ──► module.o ──link──► executable
19
+ ▲
20
+ runtime/*.c (C runtime, split by function)
21
+ ```
22
+
23
+ - Front end, back end, runtime and extensions are fully decoupled.
24
+ - The flow is orchestrated by `src/driver/compiler.ts`: `read → parse → bind → IR → object file → link`. The front end lives in `src/driver/frontend.ts`, the cache key in `src/driver/build-key.ts`, runtime compilation in `src/driver/runtime-objects.ts`, and platform artifacts in `src/driver/app-artifacts.ts`.
25
+ - **Self-hosting**: `xbintsc` compiles its own front end. Building `src/cli/main.ts`
26
+ with the compiler yields a working `xbintsc` binary, and that binary rebuilds
27
+ itself with byte-identical LLVM IR (source ≡ generation 1 ≡ generation 2 ≡
28
+ generation 3). The runtime is still hand-written C.
@@ -0,0 +1,32 @@
1
+ # C runtime core
2
+
3
+ > Part of [Implemented syntax and features](../implemented.md) · [简体中文](../zh-CN/implemented/runtime-core.md)
4
+
5
+ Location: `runtime/xt_alloc.c`, `runtime/xt_values.c`, `runtime/xt_containers.c`,
6
+ `runtime/xt_builtins.c`, `runtime/xt_constructors.c`, `runtime/xt_io.c`, sharing the
7
+ private header `runtime/rt_internal.h`; the public ABI is in `runtime/rt.h`.
8
+
9
+ Strings, symbols, typed arrays, collections, promises/async, `fetch` and the
10
+ standard-library surface have their own pages:
11
+
12
+ - [Strings and text](./strings.md)
13
+ - [Standard library](./stdlib.md)
14
+ - [Collections](./collections.md)
15
+ - [Typed arrays and binary data](./typed-arrays.md)
16
+ - [Async, promises and generators](./async.md)
17
+ - [fetch](./fetch.md)
18
+
19
+ - Allocator: non-moving mark-sweep collector behind `xt_alloc` (explicit roots, subsystem root providers and a conservative C-stack scan).
20
+ - Value construction: `xt_undefined/xt_null/xt_bool/xt_number/xt_string_new/xt_string_from_cstr`.
21
+ - Type conversion: `xt_truthy`, `xt_to_number`, `xt_to_string`, `xt_typeof`.
22
+ - Arithmetic: `add/sub/mul/div/mod/pow/neg/pos`.
23
+ - Bitwise: `and/or/xor/not/shl/shr/ushr` (including `ToInt32` semantics).
24
+ - Comparison: `lt/le/gt/ge`, loose / strict equality, `not`, `is_nullish`.
25
+ - Objects: linear property list, `object_new/get/set/has/keys/values/entries/assign/spread`.
26
+ - Arrays: `array_new/get/set/push/length/spread`; assigning `arr.length` truncates or extends (matching JS); `iter_length` / `iter_value` expose a uniform iteration view over arrays, strings (by code point), `Map` and `Set`.
27
+ - Generic member access: `xt_get` / `xt_set` (dispatch over arrays / objects / strings).
28
+ - Operator helpers: `xt_in` (`in`), `xt_delete` (`delete`), `xt_rest_args` (rest parameters / `arguments`).
29
+ - Box: `box_new/get/set` (for closure-captured variables).
30
+ - Functions and closures: `arg`, `closure_new/call/env/arity`.
31
+ - Exceptions: `xt_try_enter` / `xt_try_exception` / `xt_try_leave` maintain the `_setjmp` frame stack; `xt_throw` long-jumps to the nearest `try` when a frame exists, otherwise prints `Uncaught ...` and exits. Codegen also maintains a shadow call stack (function name, source file and line) that `Error.stack` captures (see [Standard library](./stdlib.md)), and a fatal-signal handler dumps the same frames on a native crash. `--debug` additionally emits `!DICompileUnit` / `!DISubprogram` / `!DILocation` metadata and compiles with `-g -fno-omit-frame-pointer`, so gdb/lldb/WinDbg map instructions back to source lines.
32
+ - Objects / functions: `xt_object` with a prototype chain, `xt_function` with a property bag (static members and `prototype`); `xt_new` (instantiation), `xt_instance_of` (prototype chain), `xt_object_freeze/is_frozen/from_entries`; `xt_constructors.c` holds the first-class constructor cache, constructor prototypes and static-value dispatch.
@@ -0,0 +1,78 @@
1
+ # Standard library
2
+
3
+ > Part of [Implemented syntax and features](../implemented.md) · [简体中文](../zh-CN/implemented/stdlib.md)
4
+
5
+ Location: `runtime/xt_stdlib.c`, `runtime/xt_stdlib2.c`, `runtime/xt_symbol.c`,
6
+ `runtime/xt_builtins.c`, `runtime/xt_constructors.c`, `runtime/xt_io.c`,
7
+ `runtime/xt_structured_clone.c`, `runtime/xt_url.c`.
8
+
9
+ The dispatch layer is `xt_call_method` (array / string methods and function
10
+ properties on objects), `xt_math_call` (`Math.*` and constants) and the
11
+ `xt_*` entry point of each constructor. Well-known symbols and the iterator
12
+ protocol are in [Symbol](#symbol) below; collections and typed arrays have their
13
+ own pages: [Collections](./collections.md), [Typed arrays and binary data](./typed-arrays.md).
14
+
15
+ ## Objects
16
+
17
+ - `Object.keys` / `values` / `entries` / `assign` / `getOwnPropertyNames` / `groupBy`, object spread `{...obj}`.
18
+ - `Object.defineProperty` / `getOwnPropertyDescriptor(s)` — data and accessor descriptors; the attribute flags are reported but not enforced on later writes/enumeration.
19
+ - `Object.freeze` / `is_frozen` / `from_entries`, `Object.getPrototypeOf`.
20
+ - `Object.prototype`: `hasOwnProperty` / `toString` / `valueOf` / `isPrototypeOf` / `propertyIsEnumerable` / `__proto__`; `Object.getPrototypeOf({}) === Object.prototype`.
21
+ - First-class built-in constructors (`const A = Array`, `new A(...)`, `A.isArray`, `x instanceof A`) are covered in [Codegen](./codegen.md#llvm-ir-code-generation-codegen).
22
+
23
+ ## Arrays
24
+
25
+ - `push` `pop` `shift` `unshift` `join` `slice` `splice` `indexOf` `lastIndexOf` `includes` `concat` `reverse` `forEach` `map` `filter` `reduce` `reduceRight` `find` `findIndex` `findLast` `findLastIndex` `some` `every` `sort` `flat` `flatMap` `fill` `copyWithin` `at` `keys` `values` `entries`
26
+ - Immutable helpers: `toReversed` / `toSorted` / `toSpliced` / `with`.
27
+ - Statics: `Array.isArray` / `of` / `from`.
28
+ - Default `sort` is stable and compares string forms, like Node; assigning `arr.length` truncates or extends the array.
29
+
30
+ ## Numbers, BigInt and Math
31
+
32
+ - Number formatting and coercion match Node: `toFixed` / `toPrecision` / `toExponential`, hex / octal / binary parsing, and the full `+` / relational `ToPrimitive` rules. These are covered by the differential tests.
33
+ - `BigInt` literals and values: arbitrary precision arithmetic, bitwise and shift operators, comparisons, `toString(radix)`, `BigInt()`, `BigInt.asIntN` / `BigInt.asUintN`.
34
+ - `Math`: the full function set and constants.
35
+ - `Number` statics and `Number()` conversion; `parseInt` / `parseFloat` / `isNaN` / `isFinite`.
36
+
37
+ ## JSON
38
+
39
+ - `JSON.parse` with a `reviver`.
40
+ - `JSON.stringify` with a function or array `replacer`, `toJSON`, and `space` (number or string, clamped to 10). `undefined` / function / symbol values follow the standard omission rules.
41
+ - Object keys are emitted in insertion order, with integer keys ordered numerically; circular references throw.
42
+
43
+ ## Date
44
+
45
+ - `Date` backed by `gmtime_r`; ISO 8601 parsing through `Date.parse` / `new Date(string)`.
46
+
47
+ ## RegExp
48
+
49
+ - `RegExp` uses POSIX ERE (`regcomp` / `regexec`) for `test` / `exec`, with capture groups exposed through `exec` / `match` / `replace` / `split` / `search`.
50
+ - Matching is byte-oriented and `/g` / `/y` `lastIndex` is not honoured — see [Runtime deviations](../unimplemented/deviations.md).
51
+
52
+ ## Symbol
53
+
54
+ - `Symbol(description)` primitives (`XT_OBJECT_KIND_SYMBOL`), the 13 well-known symbols (`Symbol.iterator`, `Symbol.asyncIterator`, `Symbol.match`, ...), `Symbol.for` / `Symbol.keyFor` global registry, `symbol.description` / `toString()` / `valueOf()`.
55
+ - Symbols are valid property keys (`Object.getOwnPropertySymbols`, symbol keyed `get`/`set`/`in`/`delete`), are skipped by `Object.keys` / `values` / `entries` / `for...in` / `JSON.stringify`, and print as `Symbol(desc)`.
56
+
57
+ ## URLSearchParams
58
+
59
+ - `URLSearchParams` is implemented in `runtime/xt_url.c`.
60
+
61
+ ## Errors
62
+
63
+ - The `Error` family: `Error`, `TypeError`, `RangeError`, `SyntaxError`, `ReferenceError`, `EvalError`, `URIError`, `AggregateError` — `new`, `instanceof`, `extends`, `String(err)` / `err.toString()` and `.stack`.
64
+ - `Promise.any` rejects with an `AggregateError`.
65
+ - `.stack` contains function-level frames (`at name (file:line)`), captured from the runtime shadow call stack; the exact limitations are in [Runtime deviations](../unimplemented/deviations.md).
66
+
67
+ ## console
68
+
69
+ - `xt_print` / `xt_println` / `xt_console_log` / `info` / `warn` / `error`; `info` / `log` go to stdout, `warn` / `error` to stderr.
70
+ - Node-style inspection: arrays `[ a, b ]`, objects `{ k: v }`, UTF-8-aware, with circular references marked.
71
+ - `dir` / `trace` / `assert` / `count` / `countReset` / `group` / `groupEnd` / `table` / `time` / `timeEnd` / `timeLog`.
72
+
73
+ ## Global functions
74
+
75
+ - `parseInt` `parseFloat` `isNaN` `isFinite` `Number` `String` `Boolean` `encodeURI` `decodeURI` `encodeURIComponent` `decodeURIComponent`.
76
+ - `btoa` / `atob` base64 encoding and decoding (core globals; not Node-extension-only).
77
+ - `structuredClone`: arrays, objects, `Map`, `Set`, `Date`, `RegExp` and typed arrays, preserving cycles and shared references; functions, symbols, promises and generators are rejected.
78
+ - Timers, `queueMicrotask` and `performance.now` are described in [Async, promises and generators](./async.md); `fetch` in [fetch](./fetch.md).
@@ -0,0 +1,27 @@
1
+ # Strings and text
2
+
3
+ > Part of [Implemented syntax and features](../implemented.md) · [简体中文](../zh-CN/implemented/strings.md)
4
+
5
+ Location: the string value lives in the core runtime (`runtime/xt_values.c`);
6
+ the method surface is dispatched from `runtime/xt_stdlib.c` / `xt_stdlib2.c`;
7
+ `TextEncoder` / `TextDecoder` live in `runtime/xt_text_codec.c`.
8
+
9
+ ## Value model
10
+
11
+ - UTF-8 storage exposed through JavaScript's UTF-16 view: `length`, indexing, `slice`, `indexOf`, `split`, `padStart` and `codePointAt` count code units; `for...of` and `Array.from` count code points; lone surrogate halves are kept as WTF-8 and recombined on concatenation.
12
+ - Lazy cons-node concatenation: bytes are flattened on first observation, so append loops stay linear.
13
+ - Equality comparison, and formatted number-to-string.
14
+ - `xt_string_length` reports bytes for I/O; `xt_string_utf16_length` reports the JavaScript length.
15
+
16
+ ## Methods
17
+
18
+ - `charAt` `charCodeAt` `codePointAt` `indexOf` `lastIndexOf` `includes` `startsWith` `endsWith` `slice` `substring` `substr` `split` `match` `replace` `replaceAll` `search` `toUpperCase` `toLowerCase` `trim` `trimStart` `trimEnd` `padStart` `padEnd` `repeat` `concat` `at` `localeCompare` `valueOf`
19
+ - `String.match` / `lastIndexOf` / `split` with a limit; RegExp capture groups flow through `match` / `replace` / `split` / `search` (see [Standard library](./stdlib.md)).
20
+ - `String` statics: `fromCharCode` / `fromCodePoint` / `raw`; tagged templates keep their raw strings.
21
+
22
+ ## Text encoding
23
+
24
+ - `TextEncoder` / `TextDecoder` encode and decode through a `Uint8Array`; only the UTF-8 encoding is supported.
25
+
26
+ Known divergences (`String.prototype.normalize`, byte-oriented RegExp matching)
27
+ are listed in [Unimplemented: standard library](../unimplemented/stdlib.md).
@@ -0,0 +1,10 @@
1
+ # Tests
2
+
3
+ > Part of [Implemented syntax and features](../implemented.md) · [简体中文](../zh-CN/implemented/tests.md)
4
+
5
+ Location: `tests/` (`lexer` / `parser` / `binder` / `codegen` / `driver` / `extensions` / `cli` / `e2e`)
6
+
7
+ - Per-module unit tests mirror the source tree.
8
+ - `tests/e2e/` compiles real programs and runs the resulting binaries. When `clang` is absent the suite skips itself automatically; it is not a silent pass.
9
+ - `tests/e2e/differential-*.test.ts` runs the same source through both `xbintsc` and Node and compares output byte-for-byte. When semantics change, add a differential case instead of a hand-written expected string.
10
+ - Feature pages in this directory record the supported behaviour; the tests are the executable form of that contract. See [Contributing](../ai/contributing.md) for the gate (`npm run typecheck && npm run lint && npm test`).
@@ -0,0 +1,26 @@
1
+ # Typed arrays and binary data
2
+
3
+ > Part of [Implemented syntax and features](../implemented.md) · [简体中文](../zh-CN/implemented/typed-arrays.md)
4
+
5
+ Location: `runtime/xt_typed_array.c`, `runtime/xt_array_buffer.c`.
6
+
7
+ ## Typed arrays
8
+
9
+ - `Uint8Array`, `Int8Array`, `Uint8ClampedArray`, `Uint16Array`, `Int16Array`, `Uint32Array`, `Int32Array`, `Float32Array`, `Float64Array`.
10
+ - Construction: `new X(n)` / `new X(iterable)` / `new X(buffer[, offset[, length]])` / `X.from` / `X.of`.
11
+ - Properties: `length` / `byteLength` / `byteOffset` / `.buffer` / `BYTES_PER_ELEMENT`.
12
+ - Element reads/writes apply the per-type coercion (`ToIntN` / `ToUintN`, `Uint8ClampedArray` rounding, `Float32` single-precision rounding).
13
+ - Prototype methods: `fill` / `set` / `slice` / `subarray` / `join` / `toString` / `indexOf` / `lastIndexOf` / `includes` / `forEach` / `map` / `filter` / `every` / `some` / `find` / `findIndex` / `reduce` / `reverse` / `sort` / `copyWithin` / `at` / `keys` / `values` / `entries`. Iterator methods still return arrays, not iterator objects.
14
+ - Typed arrays are views over an `ArrayBuffer`; `subarray` shares the buffer and `slice` copies.
15
+
16
+ ## ArrayBuffer and DataView
17
+
18
+ - `ArrayBuffer`: `byteLength`, `slice`, `ArrayBuffer.isView`.
19
+ - `DataView`: big-endian by default, optional `littleEndian`, with `get` / `set` for Uint8 / Int8 / Uint16 / Int16 / Uint32 / Int32 / Float32 / Float64.
20
+ - Multiple views over one buffer share its bytes.
21
+
22
+ ## Not implemented
23
+
24
+ - `BigInt64Array` / `BigUint64Array`.
25
+ - `Buffer`-backed typed-array views.
26
+ - `TextEncoder` / `TextDecoder` are implemented (UTF-8) and documented in [Strings and text](./strings.md); `structuredClone` copies typed arrays.
@@ -0,0 +1,18 @@
1
+ # Value model and calling convention
2
+
3
+ > Part of [Implemented syntax and features](../implemented.md) · [简体中文](../zh-CN/implemented/value-model.md)
4
+
5
+ Location: `src/codegen/values.ts`, `runtime/rt.h`
6
+
7
+ - All JS values are unified as a 64-bit `xt_value` (NaN-boxing).
8
+ - Doubles are not boxed; other types are tagged pointers with a 16-bit tag in the high bits and a 48-bit payload.
9
+ - Tags: `undefined` / `null` / `false` / `true` / `string` / `object` / `array` / `function`.
10
+ - Uniform function ABI:
11
+
12
+ ```c
13
+ xt_value fn(xt_value thisValue, xt_value env, int32_t argc, xt_value *argv);
14
+ ```
15
+
16
+ - `thisValue` is threaded as the first ABI parameter (exception-safe, supports nesting); arrow functions inherit `this` lexically from an extra environment slot.
17
+ - Closures thread captured variables through `env` (by reference, boxed); direct calls and closure calls share one code path.
18
+ - `xt_object` carries a prototype field, and property lookup walks the prototype chain; `xt_function` carries a `prototype` and a property bag (static members). `xt_array` also carries a `[[Prototype]]` (Array.prototype). `Object.prototype` is the root of ordinary objects and provides `hasOwnProperty` / `toString` / `valueOf` / `isPrototypeOf` / `propertyIsEnumerable` / `__proto__`; `Object.getPrototypeOf({}) === Object.prototype`.