@shd101wyy/yo 0.0.2

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 (339) hide show
  1. package/LICENSE.md +17 -0
  2. package/README.md +80 -0
  3. package/out/cjs/index.cjs +51 -0
  4. package/out/cjs/yo-cli.cjs +2158 -0
  5. package/out/esm/index.mjs +51 -0
  6. package/out/types/src/codegen/async/runtime.d.ts +2 -0
  7. package/out/types/src/codegen/async/state-code-gen.d.ts +10 -0
  8. package/out/types/src/codegen/async/state-machine.d.ts +13 -0
  9. package/out/types/src/codegen/c/collection.d.ts +3 -0
  10. package/out/types/src/codegen/codegen-c.d.ts +12 -0
  11. package/out/types/src/codegen/constants.d.ts +3 -0
  12. package/out/types/src/codegen/expressions/array.d.ts +4 -0
  13. package/out/types/src/codegen/expressions/generation.d.ts +11 -0
  14. package/out/types/src/codegen/expressions/index.d.ts +2 -0
  15. package/out/types/src/codegen/functions/collection.d.ts +5 -0
  16. package/out/types/src/codegen/functions/context.d.ts +57 -0
  17. package/out/types/src/codegen/functions/generation.d.ts +25 -0
  18. package/out/types/src/codegen/functions/index.d.ts +2 -0
  19. package/out/types/src/codegen/index.d.ts +20 -0
  20. package/out/types/src/codegen/parallelism/runtime.d.ts +2 -0
  21. package/out/types/src/codegen/types/collection.d.ts +8 -0
  22. package/out/types/src/codegen/types/generation.d.ts +13 -0
  23. package/out/types/src/codegen/types/index.d.ts +2 -0
  24. package/out/types/src/codegen/utils/fixup.d.ts +2 -0
  25. package/out/types/src/codegen/utils/index.d.ts +77 -0
  26. package/out/types/src/codegen/values/index.d.ts +1 -0
  27. package/out/types/src/emitter.d.ts +11 -0
  28. package/out/types/src/env.d.ts +85 -0
  29. package/out/types/src/error.d.ts +45 -0
  30. package/out/types/src/evaluator/async/await-analysis-types.d.ts +23 -0
  31. package/out/types/src/evaluator/async/await-analysis.d.ts +5 -0
  32. package/out/types/src/evaluator/builtins/alignof.d.ts +8 -0
  33. package/out/types/src/evaluator/builtins/and_or.d.ts +8 -0
  34. package/out/types/src/evaluator/builtins/arc_fns.d.ts +58 -0
  35. package/out/types/src/evaluator/builtins/array_fns.d.ts +0 -0
  36. package/out/types/src/evaluator/builtins/as.d.ts +8 -0
  37. package/out/types/src/evaluator/builtins/async_fns.d.ts +8 -0
  38. package/out/types/src/evaluator/builtins/compt_assert.d.ts +8 -0
  39. package/out/types/src/evaluator/builtins/compt_boolean_fns.d.ts +8 -0
  40. package/out/types/src/evaluator/builtins/compt_expect_error.d.ts +8 -0
  41. package/out/types/src/evaluator/builtins/compt_list_fns.d.ts +33 -0
  42. package/out/types/src/evaluator/builtins/compt_print.d.ts +8 -0
  43. package/out/types/src/evaluator/builtins/compt_string_fns.d.ts +8 -0
  44. package/out/types/src/evaluator/builtins/consume.d.ts +8 -0
  45. package/out/types/src/evaluator/builtins/drop.d.ts +8 -0
  46. package/out/types/src/evaluator/builtins/dup.d.ts +8 -0
  47. package/out/types/src/evaluator/builtins/expr_fns.d.ts +33 -0
  48. package/out/types/src/evaluator/builtins/future_fns.d.ts +8 -0
  49. package/out/types/src/evaluator/builtins/gc.d.ts +8 -0
  50. package/out/types/src/evaluator/builtins/gensym.d.ts +8 -0
  51. package/out/types/src/evaluator/builtins/impl_constraint.d.ts +8 -0
  52. package/out/types/src/evaluator/builtins/macro_expand.d.ts +8 -0
  53. package/out/types/src/evaluator/builtins/numeric_fns.d.ts +8 -0
  54. package/out/types/src/evaluator/builtins/panic.d.ts +8 -0
  55. package/out/types/src/evaluator/builtins/ptr_fns.d.ts +8 -0
  56. package/out/types/src/evaluator/builtins/quote.d.ts +13 -0
  57. package/out/types/src/evaluator/builtins/rc.d.ts +8 -0
  58. package/out/types/src/evaluator/builtins/sizeof.d.ts +8 -0
  59. package/out/types/src/evaluator/builtins/the.d.ts +8 -0
  60. package/out/types/src/evaluator/builtins/type_fns.d.ts +28 -0
  61. package/out/types/src/evaluator/builtins/va_start.d.ts +8 -0
  62. package/out/types/src/evaluator/builtins/var_fns.d.ts +18 -0
  63. package/out/types/src/evaluator/calls/array.d.ts +13 -0
  64. package/out/types/src/evaluator/calls/array_type.d.ts +11 -0
  65. package/out/types/src/evaluator/calls/closure_type.d.ts +11 -0
  66. package/out/types/src/evaluator/calls/compt_function.d.ts +19 -0
  67. package/out/types/src/evaluator/calls/compt_list_type.d.ts +11 -0
  68. package/out/types/src/evaluator/calls/function.d.ts +16 -0
  69. package/out/types/src/evaluator/calls/function_type.d.ts +15 -0
  70. package/out/types/src/evaluator/calls/helper.d.ts +42 -0
  71. package/out/types/src/evaluator/calls/iso.d.ts +15 -0
  72. package/out/types/src/evaluator/calls/module_type.d.ts +11 -0
  73. package/out/types/src/evaluator/calls/numeric_type.d.ts +15 -0
  74. package/out/types/src/evaluator/calls/pointer.d.ts +8 -0
  75. package/out/types/src/evaluator/calls/pointer_type.d.ts +14 -0
  76. package/out/types/src/evaluator/calls/type.d.ts +12 -0
  77. package/out/types/src/evaluator/context.d.ts +169 -0
  78. package/out/types/src/evaluator/exprs/_expr.d.ts +8 -0
  79. package/out/types/src/evaluator/exprs/assignment.d.ts +9 -0
  80. package/out/types/src/evaluator/exprs/begin.d.ts +10 -0
  81. package/out/types/src/evaluator/exprs/binding.d.ts +12 -0
  82. package/out/types/src/evaluator/exprs/c_include.d.ts +8 -0
  83. package/out/types/src/evaluator/exprs/cond.d.ts +8 -0
  84. package/out/types/src/evaluator/exprs/destructuring_assignment.d.ts +33 -0
  85. package/out/types/src/evaluator/exprs/exists.d.ts +0 -0
  86. package/out/types/src/evaluator/exprs/expr.d.ts +9 -0
  87. package/out/types/src/evaluator/exprs/extern.d.ts +8 -0
  88. package/out/types/src/evaluator/exprs/identifer_and_operator.d.ts +9 -0
  89. package/out/types/src/evaluator/exprs/import.d.ts +9 -0
  90. package/out/types/src/evaluator/exprs/initialization_assignment.d.ts +8 -0
  91. package/out/types/src/evaluator/exprs/match.d.ts +8 -0
  92. package/out/types/src/evaluator/exprs/open.d.ts +8 -0
  93. package/out/types/src/evaluator/exprs/property_access.d.ts +8 -0
  94. package/out/types/src/evaluator/exprs/recur.d.ts +8 -0
  95. package/out/types/src/evaluator/exprs/subtype_of.d.ts +21 -0
  96. package/out/types/src/evaluator/exprs/test.d.ts +8 -0
  97. package/out/types/src/evaluator/exprs/typeof.d.ts +8 -0
  98. package/out/types/src/evaluator/exprs/while.d.ts +8 -0
  99. package/out/types/src/evaluator/index.d.ts +26 -0
  100. package/out/types/src/evaluator/types/array.d.ts +8 -0
  101. package/out/types/src/evaluator/types/closure.d.ts +8 -0
  102. package/out/types/src/evaluator/types/compt_list.d.ts +8 -0
  103. package/out/types/src/evaluator/types/concrete_module.d.ts +8 -0
  104. package/out/types/src/evaluator/types/dyn.d.ts +8 -0
  105. package/out/types/src/evaluator/types/enum.d.ts +8 -0
  106. package/out/types/src/evaluator/types/expr_synthesizer.d.ts +14 -0
  107. package/out/types/src/evaluator/types/field.d.ts +14 -0
  108. package/out/types/src/evaluator/types/fn_module.d.ts +8 -0
  109. package/out/types/src/evaluator/types/function.d.ts +58 -0
  110. package/out/types/src/evaluator/types/future_module.d.ts +8 -0
  111. package/out/types/src/evaluator/types/module.d.ts +19 -0
  112. package/out/types/src/evaluator/types/newtype.d.ts +8 -0
  113. package/out/types/src/evaluator/types/object.d.ts +8 -0
  114. package/out/types/src/evaluator/types/proofs.d.ts +0 -0
  115. package/out/types/src/evaluator/types/slice.d.ts +8 -0
  116. package/out/types/src/evaluator/types/struct.d.ts +8 -0
  117. package/out/types/src/evaluator/types/synthesizer.d.ts +16 -0
  118. package/out/types/src/evaluator/types/tuple.d.ts +18 -0
  119. package/out/types/src/evaluator/types/union.d.ts +8 -0
  120. package/out/types/src/evaluator/types/utils.d.ts +71 -0
  121. package/out/types/src/evaluator/types/validation.d.ts +3 -0
  122. package/out/types/src/evaluator/utils/array-utils.d.ts +15 -0
  123. package/out/types/src/evaluator/utils/closure.d.ts +35 -0
  124. package/out/types/src/evaluator/utils.d.ts +4 -0
  125. package/out/types/src/evaluator/values/anonymous_function.d.ts +8 -0
  126. package/out/types/src/evaluator/values/anonymous_module.d.ts +17 -0
  127. package/out/types/src/evaluator/values/anonymous_struct.d.ts +8 -0
  128. package/out/types/src/evaluator/values/array.d.ts +8 -0
  129. package/out/types/src/evaluator/values/boolean.d.ts +3 -0
  130. package/out/types/src/evaluator/values/char.d.ts +3 -0
  131. package/out/types/src/evaluator/values/compt_list.d.ts +8 -0
  132. package/out/types/src/evaluator/values/dyn.d.ts +8 -0
  133. package/out/types/src/evaluator/values/float.d.ts +4 -0
  134. package/out/types/src/evaluator/values/integer.d.ts +4 -0
  135. package/out/types/src/evaluator/values/module.d.ts +58 -0
  136. package/out/types/src/evaluator/values/string.d.ts +3 -0
  137. package/out/types/src/evaluator/values/tuple.d.ts +32 -0
  138. package/out/types/src/expr.d.ts +456 -0
  139. package/out/types/src/function-value.d.ts +42 -0
  140. package/out/types/src/index.d.ts +4 -0
  141. package/out/types/src/lexer.d.ts +2 -0
  142. package/out/types/src/logger.d.ts +1 -0
  143. package/out/types/src/module-manager.d.ts +30 -0
  144. package/out/types/src/naming-checker.d.ts +4 -0
  145. package/out/types/src/parser.d.ts +33 -0
  146. package/out/types/src/test-runner.d.ts +30 -0
  147. package/out/types/src/tests/codegen.test.d.ts +1 -0
  148. package/out/types/src/tests/fixme.test.d.ts +1 -0
  149. package/out/types/src/tests/module-manager.test.d.ts +1 -0
  150. package/out/types/src/tests/parser.test.d.ts +1 -0
  151. package/out/types/src/tests/sample.test.d.ts +0 -0
  152. package/out/types/src/tests/std.test.d.ts +1 -0
  153. package/out/types/src/token.d.ts +40 -0
  154. package/out/types/src/type-value.d.ts +7 -0
  155. package/out/types/src/types/compatibility.d.ts +16 -0
  156. package/out/types/src/types/creators.d.ts +73 -0
  157. package/out/types/src/types/definitions.d.ts +218 -0
  158. package/out/types/src/types/guards.d.ts +70 -0
  159. package/out/types/src/types/hierarchy.d.ts +4 -0
  160. package/out/types/src/types/index.d.ts +7 -0
  161. package/out/types/src/types/module_field.d.ts +2 -0
  162. package/out/types/src/types/tags.d.ts +45 -0
  163. package/out/types/src/types/utils.d.ts +50 -0
  164. package/out/types/src/unit-value.d.ts +7 -0
  165. package/out/types/src/utils.d.ts +6 -0
  166. package/out/types/src/value-tag.d.ts +29 -0
  167. package/out/types/src/value.d.ts +110 -0
  168. package/out/types/src/yo-cli.d.ts +1 -0
  169. package/out/types/tsconfig.tsbuildinfo +1 -0
  170. package/package.json +57 -0
  171. package/scripts/check-liburing.js +76 -0
  172. package/std/alg/hash.yo +50 -0
  173. package/std/allocator.yo +113 -0
  174. package/std/allocators/c_allocator.yo +118 -0
  175. package/std/async.yo +13 -0
  176. package/std/collections/array_list.yo +415 -0
  177. package/std/collections/hash_map.yo +482 -0
  178. package/std/collections/hash_set.yo +706 -0
  179. package/std/collections/index.yo +11 -0
  180. package/std/collections/linked_list.yo +439 -0
  181. package/std/error.yo +0 -0
  182. package/std/gc.yo +10 -0
  183. package/std/index.yo +12 -0
  184. package/std/io/file.yo +191 -0
  185. package/std/io/index.yo +5 -0
  186. package/std/libc/assert.yo +39 -0
  187. package/std/libc/ctype.yo +57 -0
  188. package/std/libc/errno.yo +182 -0
  189. package/std/libc/float.yo +87 -0
  190. package/std/libc/index.yo +29 -0
  191. package/std/libc/limits.yo +65 -0
  192. package/std/libc/math.yo +679 -0
  193. package/std/libc/signal.yo +101 -0
  194. package/std/libc/stdatomic.yo +213 -0
  195. package/std/libc/stdint.yo +214 -0
  196. package/std/libc/stdio.yo +225 -0
  197. package/std/libc/stdlib.yo +204 -0
  198. package/std/libc/string.yo +151 -0
  199. package/std/libc/time.yo +92 -0
  200. package/std/libc/unistd.yo +130 -0
  201. package/std/monad.yo +152 -0
  202. package/std/prelude.yo +3094 -0
  203. package/std/string/index.yo +8 -0
  204. package/std/string/rune.yo +82 -0
  205. package/std/string/string.yo +288 -0
  206. package/std/sync.yo +95 -0
  207. package/std/thread.yo +36 -0
  208. package/std/time.yo +13 -0
  209. package/std/worker.yo +36 -0
  210. package/vendor/mimalloc/.gitattributes +12 -0
  211. package/vendor/mimalloc/CMakeLists.txt +763 -0
  212. package/vendor/mimalloc/LICENSE +21 -0
  213. package/vendor/mimalloc/SECURITY.md +41 -0
  214. package/vendor/mimalloc/azure-pipelines.yml +251 -0
  215. package/vendor/mimalloc/bin/mimalloc-redirect-arm64.dll +0 -0
  216. package/vendor/mimalloc/bin/mimalloc-redirect-arm64.lib +0 -0
  217. package/vendor/mimalloc/bin/mimalloc-redirect-arm64ec.dll +0 -0
  218. package/vendor/mimalloc/bin/mimalloc-redirect-arm64ec.lib +0 -0
  219. package/vendor/mimalloc/bin/mimalloc-redirect.dll +0 -0
  220. package/vendor/mimalloc/bin/mimalloc-redirect.lib +0 -0
  221. package/vendor/mimalloc/bin/mimalloc-redirect32.dll +0 -0
  222. package/vendor/mimalloc/bin/mimalloc-redirect32.lib +0 -0
  223. package/vendor/mimalloc/bin/minject-arm64.exe +0 -0
  224. package/vendor/mimalloc/bin/minject.exe +0 -0
  225. package/vendor/mimalloc/bin/minject32.exe +0 -0
  226. package/vendor/mimalloc/bin/readme.md +118 -0
  227. package/vendor/mimalloc/cmake/JoinPaths.cmake +23 -0
  228. package/vendor/mimalloc/cmake/mimalloc-config-version.cmake +19 -0
  229. package/vendor/mimalloc/cmake/mimalloc-config.cmake +14 -0
  230. package/vendor/mimalloc/contrib/docker/alpine/Dockerfile +23 -0
  231. package/vendor/mimalloc/contrib/docker/alpine-arm32v7/Dockerfile +28 -0
  232. package/vendor/mimalloc/contrib/docker/alpine-x86/Dockerfile +28 -0
  233. package/vendor/mimalloc/contrib/docker/manylinux-x64/Dockerfile +23 -0
  234. package/vendor/mimalloc/contrib/docker/readme.md +10 -0
  235. package/vendor/mimalloc/contrib/vcpkg/portfile.cmake +64 -0
  236. package/vendor/mimalloc/contrib/vcpkg/readme.md +40 -0
  237. package/vendor/mimalloc/contrib/vcpkg/usage +20 -0
  238. package/vendor/mimalloc/contrib/vcpkg/vcpkg-cmake-wrapper.cmake +20 -0
  239. package/vendor/mimalloc/contrib/vcpkg/vcpkg.json +48 -0
  240. package/vendor/mimalloc/doc/bench-2020/bench-c5-18xlarge-2020-01-20-a.svg +887 -0
  241. package/vendor/mimalloc/doc/bench-2020/bench-c5-18xlarge-2020-01-20-b.svg +1185 -0
  242. package/vendor/mimalloc/doc/bench-2020/bench-c5-18xlarge-2020-01-20-rss-a.svg +757 -0
  243. package/vendor/mimalloc/doc/bench-2020/bench-c5-18xlarge-2020-01-20-rss-b.svg +1028 -0
  244. package/vendor/mimalloc/doc/bench-2020/bench-r5a-1.svg +769 -0
  245. package/vendor/mimalloc/doc/bench-2020/bench-r5a-12xlarge-2020-01-16-a.svg +868 -0
  246. package/vendor/mimalloc/doc/bench-2020/bench-r5a-12xlarge-2020-01-16-b.svg +1157 -0
  247. package/vendor/mimalloc/doc/bench-2020/bench-r5a-2.svg +983 -0
  248. package/vendor/mimalloc/doc/bench-2020/bench-r5a-rss-1.svg +683 -0
  249. package/vendor/mimalloc/doc/bench-2020/bench-r5a-rss-2.svg +854 -0
  250. package/vendor/mimalloc/doc/bench-2020/bench-spec-rss.svg +713 -0
  251. package/vendor/mimalloc/doc/bench-2020/bench-spec.svg +713 -0
  252. package/vendor/mimalloc/doc/bench-2020/bench-z4-1.svg +890 -0
  253. package/vendor/mimalloc/doc/bench-2020/bench-z4-2.svg +1146 -0
  254. package/vendor/mimalloc/doc/bench-2020/bench-z4-rss-1.svg +796 -0
  255. package/vendor/mimalloc/doc/bench-2020/bench-z4-rss-2.svg +974 -0
  256. package/vendor/mimalloc/doc/bench-2021/bench-amd5950x-2021-01-30-a.svg +952 -0
  257. package/vendor/mimalloc/doc/bench-2021/bench-amd5950x-2021-01-30-b.svg +1255 -0
  258. package/vendor/mimalloc/doc/bench-2021/bench-c5-18xlarge-2021-01-30-a.svg +955 -0
  259. package/vendor/mimalloc/doc/bench-2021/bench-c5-18xlarge-2021-01-30-b.svg +1269 -0
  260. package/vendor/mimalloc/doc/bench-2021/bench-c5-18xlarge-2021-01-30-rss-a.svg +836 -0
  261. package/vendor/mimalloc/doc/bench-2021/bench-c5-18xlarge-2021-01-30-rss-b.svg +1131 -0
  262. package/vendor/mimalloc/doc/bench-2021/bench-macmini-2021-01-30.svg +766 -0
  263. package/vendor/mimalloc/doc/doxyfile +2895 -0
  264. package/vendor/mimalloc/doc/ds-logo.jpg +0 -0
  265. package/vendor/mimalloc/doc/ds-logo.png +0 -0
  266. package/vendor/mimalloc/doc/mimalloc-doc.h +1452 -0
  267. package/vendor/mimalloc/doc/mimalloc-doxygen.css +60 -0
  268. package/vendor/mimalloc/doc/mimalloc-logo-100.png +0 -0
  269. package/vendor/mimalloc/doc/mimalloc-logo.png +0 -0
  270. package/vendor/mimalloc/doc/mimalloc-logo.svg +161 -0
  271. package/vendor/mimalloc/doc/spades-logo.png +0 -0
  272. package/vendor/mimalloc/doc/unreal-logo.svg +43 -0
  273. package/vendor/mimalloc/ide/vs2022/mimalloc-lib.vcxproj +500 -0
  274. package/vendor/mimalloc/ide/vs2022/mimalloc-lib.vcxproj.filters +108 -0
  275. package/vendor/mimalloc/ide/vs2022/mimalloc-override-dll.vcxproj +508 -0
  276. package/vendor/mimalloc/ide/vs2022/mimalloc-override-dll.vcxproj.filters +111 -0
  277. package/vendor/mimalloc/ide/vs2022/mimalloc-override-test-dep.vcxproj +355 -0
  278. package/vendor/mimalloc/ide/vs2022/mimalloc-override-test.vcxproj +360 -0
  279. package/vendor/mimalloc/ide/vs2022/mimalloc-test-api.vcxproj +295 -0
  280. package/vendor/mimalloc/ide/vs2022/mimalloc-test-stress.vcxproj +292 -0
  281. package/vendor/mimalloc/ide/vs2022/mimalloc-test.vcxproj +289 -0
  282. package/vendor/mimalloc/ide/vs2022/mimalloc.sln +151 -0
  283. package/vendor/mimalloc/include/mimalloc/atomic.h +557 -0
  284. package/vendor/mimalloc/include/mimalloc/internal.h +1153 -0
  285. package/vendor/mimalloc/include/mimalloc/prim.h +421 -0
  286. package/vendor/mimalloc/include/mimalloc/track.h +145 -0
  287. package/vendor/mimalloc/include/mimalloc/types.h +685 -0
  288. package/vendor/mimalloc/include/mimalloc-new-delete.h +66 -0
  289. package/vendor/mimalloc/include/mimalloc-override.h +68 -0
  290. package/vendor/mimalloc/include/mimalloc-stats.h +103 -0
  291. package/vendor/mimalloc/include/mimalloc.h +612 -0
  292. package/vendor/mimalloc/mimalloc.pc.in +11 -0
  293. package/vendor/mimalloc/readme.md +946 -0
  294. package/vendor/mimalloc/src/alloc-aligned.c +360 -0
  295. package/vendor/mimalloc/src/alloc-override.c +316 -0
  296. package/vendor/mimalloc/src/alloc-posix.c +185 -0
  297. package/vendor/mimalloc/src/alloc.c +692 -0
  298. package/vendor/mimalloc/src/arena-abandon.c +346 -0
  299. package/vendor/mimalloc/src/arena.c +1043 -0
  300. package/vendor/mimalloc/src/bitmap.c +441 -0
  301. package/vendor/mimalloc/src/bitmap.h +119 -0
  302. package/vendor/mimalloc/src/free.c +572 -0
  303. package/vendor/mimalloc/src/heap.c +733 -0
  304. package/vendor/mimalloc/src/init.c +714 -0
  305. package/vendor/mimalloc/src/libc.c +334 -0
  306. package/vendor/mimalloc/src/options.c +663 -0
  307. package/vendor/mimalloc/src/os.c +770 -0
  308. package/vendor/mimalloc/src/page-queue.c +390 -0
  309. package/vendor/mimalloc/src/page.c +1049 -0
  310. package/vendor/mimalloc/src/prim/emscripten/prim.c +249 -0
  311. package/vendor/mimalloc/src/prim/osx/alloc-override-zone.c +461 -0
  312. package/vendor/mimalloc/src/prim/osx/prim.c +9 -0
  313. package/vendor/mimalloc/src/prim/prim.c +76 -0
  314. package/vendor/mimalloc/src/prim/readme.md +9 -0
  315. package/vendor/mimalloc/src/prim/unix/prim.c +934 -0
  316. package/vendor/mimalloc/src/prim/wasi/prim.c +284 -0
  317. package/vendor/mimalloc/src/prim/windows/etw-mimalloc.wprp +61 -0
  318. package/vendor/mimalloc/src/prim/windows/etw.h +905 -0
  319. package/vendor/mimalloc/src/prim/windows/etw.man +0 -0
  320. package/vendor/mimalloc/src/prim/windows/prim.c +878 -0
  321. package/vendor/mimalloc/src/prim/windows/readme.md +17 -0
  322. package/vendor/mimalloc/src/random.c +258 -0
  323. package/vendor/mimalloc/src/segment-map.c +142 -0
  324. package/vendor/mimalloc/src/segment.c +1702 -0
  325. package/vendor/mimalloc/src/static.c +41 -0
  326. package/vendor/mimalloc/src/stats.c +635 -0
  327. package/vendor/mimalloc/test/CMakeLists.txt +56 -0
  328. package/vendor/mimalloc/test/main-override-dep.cpp +51 -0
  329. package/vendor/mimalloc/test/main-override-dep.h +11 -0
  330. package/vendor/mimalloc/test/main-override-static.c +539 -0
  331. package/vendor/mimalloc/test/main-override.c +36 -0
  332. package/vendor/mimalloc/test/main-override.cpp +497 -0
  333. package/vendor/mimalloc/test/main.c +46 -0
  334. package/vendor/mimalloc/test/readme.md +16 -0
  335. package/vendor/mimalloc/test/test-api-fill.c +343 -0
  336. package/vendor/mimalloc/test/test-api.c +466 -0
  337. package/vendor/mimalloc/test/test-stress.c +428 -0
  338. package/vendor/mimalloc/test/test-wrong.c +92 -0
  339. package/vendor/mimalloc/test/testhelper.h +49 -0
@@ -0,0 +1,8 @@
1
+ // other data types
2
+ _rune :: import "./rune.yo";
3
+ _string :: import "./string.yo";
4
+
5
+ export
6
+ ...(_rune),
7
+ ...(_string)
8
+ ;
@@ -0,0 +1,82 @@
1
+ rune :: newtype(
2
+ c : u32,
3
+
4
+ from_u32 :: ((fn(value: u32) -> Option(Self))
5
+ cond(
6
+ ((value <= u32(0x10FFFF)) && (((value < 0xD800) || (value > 0xDFFF)))) => .Some(Self(c: value)),
7
+ true => .None
8
+ )
9
+ ),
10
+
11
+ to_u32 :: ((fn(self: Self) -> u32)
12
+ self.c
13
+ ),
14
+
15
+ is_ascii :: ((fn(self: Self) -> bool)
16
+ (self.c <= 0x7F)
17
+ ),
18
+
19
+ is_whitespace :: ((fn(self: Self) -> bool)
20
+ (((self.c == 0x20) || (self.c == 0x09)) || ((self.c == 0x0A) || (self.c == 0x0D)))
21
+ ),
22
+
23
+ is_digit :: ((fn(self: Self) -> bool)
24
+ ((self.c >= 0x30) && (self.c <= 0x39))
25
+ ),
26
+
27
+ is_alphabetic :: ((fn(self: Self) -> bool)
28
+ (((self.c >= 0x41) && (self.c <= 0x5A)) || ((self.c >= 0x61) && (self.c <= 0x7A)))
29
+ ),
30
+
31
+ is_uppercase :: ((fn(self: Self) -> bool)
32
+ ((self.c >= 0x41) && (self.c <= 0x5A))
33
+ ),
34
+
35
+ is_lowercase :: ((fn(self: Self) -> bool)
36
+ ((self.c >= 0x61) && (self.c <= 0x7A))
37
+ ),
38
+
39
+ to_lowercase :: ((fn(self: Self) -> Self)
40
+ cond(
41
+ self.is_uppercase() => Self(c: (self.c + 32)),
42
+ true => self
43
+ )
44
+ ),
45
+
46
+ to_uppercase :: ((fn(self: Self) -> Self)
47
+ cond(
48
+ self.is_lowercase() => Self(c: (self.c - 32)),
49
+ true => self
50
+ )
51
+ ),
52
+
53
+ // Some constants
54
+ NUL :: Self(c: 0x00),
55
+ TAB :: Self(c: 0x09),
56
+ NEWLINE :: Self(c: 0x0A),
57
+ SPACE :: Self(c: 0x20),
58
+ ZERO :: Self(c: 0x30),
59
+ NINE :: Self(c: 0x39),
60
+ UPPERCASE_A :: Self(c: 0x41),
61
+ UPPERCASE_Z :: Self(c: 0x5A),
62
+ LOWERCASE_A :: Self(c: 0x61),
63
+ LOWERCASE_Z :: Self(c: 0x7A)
64
+ );
65
+
66
+ impl(rune, Eq(rune)(
67
+ (==) : ((a, b) -> (a.c == b.c)),
68
+ (!=) : ((a, b) -> (a.c != b.c))
69
+ ));
70
+
71
+ impl(rune, Ord(rune)(
72
+ (<) : ((a, b) -> (a.c < b.c)),
73
+ (<=) : ((a, b) -> (a.c <= b.c)),
74
+ (>) : ((a, b) -> (a.c > b.c)),
75
+ (>=) : ((a, b) -> (a.c >= b.c))
76
+ ));
77
+
78
+ impl(rune, Send());
79
+
80
+ export
81
+ rune
82
+ ;
@@ -0,0 +1,288 @@
1
+ { ArrayList } :: import "../collections/array_list.yo";
2
+ { rune } :: import "./rune.yo";
3
+
4
+ StringError :: enum(
5
+ InvalidUtf8,
6
+ IndexOutOfBounds(index: usize, length: usize)
7
+ );
8
+
9
+ /**
10
+ * String - Immutable UTF-8 encoded string
11
+ *
12
+ * Similar to JavaScript String, Python str, and Rust String.
13
+ * Strings are immutable - all operations return new strings.
14
+ *
15
+ * Internal storage uses ArrayList(u8) for UTF-8 bytes.
16
+ */
17
+ String :: object(
18
+ _bytes: ArrayList(u8),
19
+
20
+ /**
21
+ * Create a new empty string
22
+ */
23
+ new :: (fn() -> Self)(
24
+ Self(_bytes: ArrayList(u8).new())
25
+ ),
26
+
27
+ /**
28
+ * Create a string from raw bytes (assumes valid UTF-8)
29
+ * No validation is performed - the caller must ensure bytes are valid UTF-8
30
+ */
31
+ from_bytes :: (fn(bytes: ArrayList(u8)) -> Self)(
32
+ Self(_bytes: bytes)
33
+ ),
34
+
35
+ /**
36
+ * Create a string from a slice of bytes [u8]
37
+ * The slice is a fat pointer containing data pointer and length
38
+ * Example: String.from(slice) where slice is [u8]
39
+ */
40
+ from :: (fn(slice: [u8]) -> Self)({
41
+ // Create a new ArrayList and copy bytes from the slice
42
+ bytes := ArrayList(u8).with_capacity(slice.len());
43
+
44
+ i := usize(0);
45
+ while ((i < slice.len())),
46
+ (i = (i + usize(1))),
47
+ {
48
+ byte := slice(i);
49
+ bytes.push(byte);
50
+ };
51
+
52
+ return Self(_bytes: bytes);
53
+ }),
54
+
55
+ /**
56
+ * Create a string from a C null-terminated string *(u8)
57
+ * Copies bytes until it finds a null byte (0)
58
+ * Example: String.from_cstr(c_string_ptr)
59
+ *
60
+ * Note: We manually search for the null terminator by iterating
61
+ */
62
+ from_cstr :: (fn(cstr: *(u8)) -> Result(Self, StringError))({
63
+ // Create a new ArrayList to store the bytes
64
+ bytes := ArrayList(u8).new();
65
+
66
+ // Iterate through the C string until we find the null terminator
67
+ i := usize(0);
68
+ // FIXME: This is causing infinite loop during compile-time evaluation.
69
+ // We need to check if the loop body has runtime expr, then we shouldn't consider it as infinite loop.
70
+ while {f := true; f}, (i = (i + usize(1))), {
71
+ // Access byte at index i using pointer arithmetic/
72
+ byte_ptr := (cstr &+ i);
73
+ byte := byte_ptr.*;
74
+
75
+ // Stop when we find the null terminator
76
+ cond(
77
+ (byte == u8(0)) => break,
78
+ true => bytes.push(byte)
79
+ );
80
+ };
81
+
82
+ return .Ok(Self(_bytes: bytes));
83
+ }),
84
+
85
+ /**
86
+ * Get the length of the string in Unicode characters (runes)
87
+ * For "你好世界", this returns 4
88
+ */
89
+ len :: (fn(self: Self) -> usize)({
90
+ count := usize(0);
91
+ byte_index := usize(0);
92
+ total_bytes := self._bytes.len();
93
+
94
+ while ((byte_index < total_bytes)),
95
+ (byte_index = (byte_index + usize(1))),
96
+ {
97
+ byte_opt := self._bytes.get(byte_index);
98
+ match(byte_opt,
99
+ .Some(byte) => {
100
+ // Count UTF-8 character start bytes (not continuation bytes)
101
+ // Continuation bytes have pattern 10xxxxxx (0x80-0xBF)
102
+ cond(
103
+ ((byte < u8(0x80)) || (byte >= u8(0xC0))) => {
104
+ count = (count + usize(1));
105
+ },
106
+ true => ()
107
+ );
108
+ },
109
+ .None => ()
110
+ );
111
+ };
112
+
113
+ return count;
114
+ }),
115
+
116
+ /**
117
+ * Check if the string is empty
118
+ */
119
+ is_empty :: ((fn(self: Self) -> bool)
120
+ (self._bytes.len() == usize(0))
121
+ ),
122
+
123
+ /**
124
+ * Get a reference to the internal byte array
125
+ */
126
+ as_bytes :: (fn(self: Self) -> ArrayList(u8))(
127
+ self._bytes
128
+ ),
129
+ // as_bytes :: (fn(self: Self) -> ArrayList(u8))({
130
+ // return self._bytes;
131
+ // }),
132
+
133
+ /**
134
+ * Decode a UTF-8 encoded rune starting at the given byte index
135
+ * Internal helper method
136
+ */
137
+ _decode_rune_at :: (fn(self: Self, byte_index: usize) -> Option(rune))({
138
+ first_byte_opt := self._bytes.get(byte_index);
139
+ match(first_byte_opt,
140
+ .Some(first_byte) => {
141
+ // Determine how many bytes this UTF-8 character uses
142
+ (res : Option(rune)) = cond(
143
+ // 1-byte character: 0xxxxxxx (ASCII)
144
+ (first_byte < u8(0x80)) => {
145
+ codepoint := u32(first_byte);
146
+ rune.from_u32(codepoint)
147
+ },
148
+ // 2-byte character: 110xxxxx 10xxxxxx
149
+ ((first_byte >= u8(0xC0)) && (first_byte < u8(0xE0))) => {
150
+ second_opt := self._bytes.get((byte_index + usize(1)));
151
+ match(second_opt,
152
+ .Some(second) => {
153
+ codepoint := (((u32(first_byte) & u32(0x1F)) << u32(6)) | (u32(second) & u32(0x3F)));
154
+ rune.from_u32(codepoint)
155
+ },
156
+ .None => .None
157
+ )
158
+ },
159
+ // 3-byte character: 1110xxxx 10xxxxxx 10xxxxxx
160
+ ((first_byte >= u8(0xE0)) && (first_byte < u8(0xF0))) => {
161
+ second_opt := self._bytes.get((byte_index + usize(1)));
162
+ third_opt := self._bytes.get((byte_index + usize(2)));
163
+ match(second_opt,
164
+ .Some(second) =>
165
+ match(third_opt,
166
+ .Some(third) => {
167
+ codepoint := ((((u32(first_byte) & u32(0x0F)) << u32(12)) | ((u32(second) & u32(0x3F)) << u32(6))) | (u32(third) & u32(0x3F)));
168
+ rune.from_u32(codepoint)
169
+ },
170
+ .None => .None
171
+ ),
172
+ .None => .None
173
+ )
174
+ },
175
+ // 4-byte character: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
176
+ ((first_byte >= u8(0xF0)) && (first_byte < u8(0xF8))) => {
177
+ second_opt := self._bytes.get((byte_index + usize(1)));
178
+ third_opt := self._bytes.get((byte_index + usize(2)));
179
+ fourth_opt := self._bytes.get((byte_index + usize(3)));
180
+ match(second_opt,
181
+ .Some(second) =>
182
+ match(third_opt,
183
+ .Some(third) =>
184
+ match(fourth_opt,
185
+ .Some(fourth) => {
186
+ codepoint := (((((u32(first_byte) & u32(0x07)) << u32(18)) | ((u32(second) & u32(0x3F)) << u32(12))) | ((u32(third) & u32(0x3F)) << u32(6))) | (u32(fourth) & u32(0x3F)));
187
+ rune.from_u32(codepoint)
188
+ },
189
+ .None => .None
190
+ ),
191
+ .None => .None
192
+ ),
193
+ .None => .None
194
+ )
195
+ },
196
+ // Invalid UTF-8 start byte
197
+ true => .None
198
+ );
199
+ return res;
200
+ },
201
+ .None => .None
202
+ )
203
+ }),
204
+
205
+ /**
206
+ * Get the rune at the specified character index (0-based)
207
+ * Returns None if index is out of bounds
208
+ * For "你好世界", at(0) returns '你', at(1) returns '好', etc.
209
+ */
210
+ at :: (fn(self: Self, index: usize) -> Option(rune))({
211
+ char_count := usize(0);
212
+ byte_index := usize(0);
213
+ total_bytes := self._bytes.len();
214
+
215
+ // Find the byte position of the character at the given index
216
+ while ((byte_index < total_bytes)),
217
+ (byte_index = (byte_index + usize(1))),
218
+ {
219
+ byte_opt := self._bytes.get(byte_index);
220
+ match(byte_opt,
221
+ .Some(byte) => {
222
+ // Check if this is a UTF-8 character start byte
223
+ is_start := ((byte < u8(0x80)) || (byte >= u8(0xC0)));
224
+ cond(
225
+ is_start => {
226
+ // Found a character start byte
227
+ cond(
228
+ (char_count == index) => {
229
+ // This is the character we want, decode it
230
+ return self._decode_rune_at(byte_index);
231
+ },
232
+ true => {
233
+ // Not the right character yet, keep counting
234
+ char_count = (char_count + usize(1));
235
+ }
236
+ );
237
+ },
238
+ true => ()
239
+ );
240
+ },
241
+ .None => ()
242
+ );
243
+ };
244
+
245
+ // Index out of bounds
246
+ return .None;
247
+ }),
248
+
249
+ /**
250
+ * Concatenate two strings (like JavaScript +)
251
+ */
252
+ concat :: (fn(self: Self, other: Self) -> Self)({
253
+ self_len := self._bytes.len();
254
+ other_len := other._bytes.len();
255
+ new_bytes := ArrayList(u8).with_capacity((self_len + other_len));
256
+
257
+ // Copy bytes from self
258
+ i := usize(0);
259
+ while ((i < self_len)),
260
+ (i = (i + usize(1))),
261
+ {
262
+ byte_opt := self._bytes.get(i);
263
+ match(byte_opt,
264
+ .Some(byte) => { new_bytes.push(byte); },
265
+ .None => { panic("String.concat: failed to get byte from self"); }
266
+ );
267
+ };
268
+
269
+ // Copy bytes from other
270
+ j := usize(0);
271
+ while ((j < other_len)),
272
+ (j = (j + usize(1))),
273
+ {
274
+ byte_opt := other._bytes.get(j);
275
+ match(byte_opt,
276
+ .Some(byte) => { new_bytes.push(byte); },
277
+ .None => { panic("String.concat: failed to get byte from other"); }
278
+ );
279
+ };
280
+
281
+ return Self(_bytes: new_bytes);
282
+ })
283
+ );
284
+
285
+ export
286
+ String,
287
+ StringError
288
+ ;
package/std/sync.yo ADDED
@@ -0,0 +1,95 @@
1
+ extern "Yo",
2
+ YO_THREAD_SYNC_TYPE : Type,
3
+ YO_COND_TYPE : Type,
4
+ yo_mutex_create : (fn() -> YO_THREAD_SYNC_TYPE),
5
+ yo_cond_create : (fn() -> YO_COND_TYPE),
6
+ yo_mutex_lock : (fn(mutex : *(YO_THREAD_SYNC_TYPE)) -> unit),
7
+ yo_mutex_unlock : (fn(mutex : *(YO_THREAD_SYNC_TYPE)) -> unit),
8
+ yo_mutex_destroy : (fn(mutex : *(YO_THREAD_SYNC_TYPE)) -> unit),
9
+ yo_cond_wait : (fn(cv : *(YO_COND_TYPE), mutex : *(YO_THREAD_SYNC_TYPE)) -> unit),
10
+ yo_cond_signal : (fn(cv : *(YO_COND_TYPE)) -> unit),
11
+ yo_cond_broadcast : (fn(cv : *(YO_COND_TYPE)) -> unit),
12
+ yo_cond_destroy : (fn(cv : *(YO_COND_TYPE)) -> unit)
13
+ ;
14
+
15
+ mutex_t :: newtype(
16
+ mutex : YO_THREAD_SYNC_TYPE,
17
+
18
+ new :: ((fn() -> Self) {
19
+ return Self(yo_mutex_create());
20
+ }),
21
+ lock :: ((fn(self : *(Self))-> unit) {
22
+ return yo_mutex_lock(&(self.mutex));
23
+ }),
24
+ unlock :: ((fn(self : *(Self)) -> unit) {
25
+ return yo_mutex_unlock(&(self.mutex));
26
+ }),
27
+ destroy :: ((fn(self : *(Self)) -> unit) {
28
+ return yo_mutex_destroy(&(self.mutex));
29
+ })
30
+ );
31
+
32
+ // GC managed
33
+ Mutex :: object(
34
+ mutex : YO_THREAD_SYNC_TYPE,
35
+
36
+ new :: ((fn() -> Self) {
37
+ return Self(yo_mutex_create());
38
+ }),
39
+ lock :: ((fn(self : Self)-> unit) {
40
+ return yo_mutex_lock(&(self.mutex));
41
+ }),
42
+ unlock :: ((fn(self : Self) -> unit) {
43
+ return yo_mutex_unlock(&(self.mutex));
44
+ }),
45
+ dispose :: ((fn(self : Self) -> unit) {
46
+ return yo_mutex_destroy(&(self.mutex));
47
+ })
48
+ );
49
+
50
+ cond_t :: newtype(
51
+ cv : YO_COND_TYPE,
52
+
53
+ new :: ((fn() -> Self) {
54
+ return Self(yo_cond_create());
55
+ }),
56
+ wait :: ((fn(self : *(Self), mutex : *(mutex_t)) -> unit) {
57
+ return yo_cond_wait(&(self.cv), &(mutex.mutex));
58
+ }),
59
+ signal :: ((fn(self : *(Self)) -> unit) {
60
+ return yo_cond_signal(&(self.cv));
61
+ }),
62
+ broadcast :: ((fn(self : *(Self)) -> unit) {
63
+ return yo_cond_broadcast(&(self.cv));
64
+ }),
65
+ destroy :: ((fn(self : *(Self)) -> unit) {
66
+ return yo_cond_destroy(&(self.cv));
67
+ })
68
+ );
69
+
70
+ Cond :: object(
71
+ cv : YO_COND_TYPE,
72
+
73
+ new :: ((fn() -> Self) {
74
+ return Self(yo_cond_create());
75
+ }),
76
+ wait :: ((fn(self : Self, mutex : Mutex) -> unit) {
77
+ return yo_cond_wait(&(self.cv), &(mutex.mutex));
78
+ }),
79
+ signal :: ((fn(self : Self) -> unit) {
80
+ return yo_cond_signal(&(self.cv));
81
+ }),
82
+ broadcast :: ((fn(self : Self) -> unit) {
83
+ return yo_cond_broadcast(&(self.cv));
84
+ }),
85
+ dispose :: ((fn(self : Self) -> unit) {
86
+ return yo_cond_destroy(&(self.cv));
87
+ })
88
+ );
89
+
90
+ export
91
+ mutex_t,
92
+ Mutex,
93
+ cond_t,
94
+ Cond
95
+ ;
package/std/thread.yo ADDED
@@ -0,0 +1,36 @@
1
+ extern "Yo",
2
+ // Thread utilities
3
+ __yo_thread_get_hardware_threads: (fn() -> usize),
4
+ __yo_get_thread_id : (fn() -> usize),
5
+ __yo_get_cpu_id : (fn() -> i32)
6
+ ;
7
+
8
+ // Low-level runtime types and functions for Thread
9
+ extern "Yo",
10
+ __yo_thread_t : Type,
11
+ __yo_thread_spawn : (fn(cb : Impl(Fn() -> unit, Send)) -> __yo_thread_t),
12
+ __yo_thread_join : (fn(t : __yo_thread_t) -> unit)
13
+ ;
14
+
15
+ // High-level Thread wrapper - a simple struct (stack allocated)
16
+ Thread :: struct(
17
+ handle : __yo_thread_t,
18
+
19
+ // Spawn a new OS thread running the given closure
20
+ spawn :: (fn(cb : Impl(Fn() -> unit, Send)) -> Self)({
21
+ raw := __yo_thread_spawn(cb);
22
+ Self(raw)
23
+ }),
24
+
25
+ // Wait for the thread to complete (blocking)
26
+ join :: (fn(self : *(Self)) -> unit)(
27
+ __yo_thread_join(self.handle)
28
+ )
29
+ );
30
+
31
+ export
32
+ get_hardware_threads : __yo_thread_get_hardware_threads,
33
+ get_thread_id : __yo_get_thread_id,
34
+ get_cpu_id : __yo_get_cpu_id,
35
+ Thread
36
+ ;
package/std/time.yo ADDED
@@ -0,0 +1,13 @@
1
+ extern "Yo",
2
+ __yo_ms_sleep: (fn(ms: usize) -> unit)
3
+ ;
4
+
5
+ Time :: impl {
6
+ sleep :: __yo_ms_sleep;
7
+
8
+ export sleep;
9
+ };
10
+
11
+ export
12
+ Time
13
+ ;
package/std/worker.yo ADDED
@@ -0,0 +1,36 @@
1
+ // Worker - Thread Pool with Thread Affinity
2
+ // ==========================================
3
+ // Worker spawns tasks on a thread pool. Each task has thread affinity:
4
+ // tasks are distributed round-robin to worker threads and stay on their
5
+ // assigned thread (no work stealing).
6
+ //
7
+ // Thread-per-core: By default, one worker thread per CPU core.
8
+ // Thread affinity: Each task runs on a specific worker thread.
9
+ // Thread-local GC: Each worker thread has its own GC heap.
10
+
11
+ extern "Yo",
12
+ __yo_worker_spawn : (fn(cb : Impl(Fn() -> unit, Send)) -> unit),
13
+ __yo_worker_get_num_threads : (fn() -> usize),
14
+ __yo_worker_set_num_threads : (fn(num: usize) -> unit)
15
+ ;
16
+
17
+ // Spawn a task on the thread pool.
18
+ // Returns immediately, task runs in background.
19
+ // Tasks are distributed round-robin to worker threads.
20
+ spawn :: (fn(cb : Impl(Fn() -> unit, Send)) -> unit)({
21
+ __yo_worker_spawn(cb);
22
+ });
23
+
24
+ // Get number of threads in pool.
25
+ // Default: number of hardware threads (CPU cores).
26
+ get_num_threads :: (fn() -> usize)(
27
+ __yo_worker_get_num_threads()
28
+ );
29
+
30
+ // Configure thread pool size.
31
+ // Must be called before first spawn to take effect.
32
+ set_num_threads :: (fn(num: usize) -> unit)(
33
+ __yo_worker_set_num_threads(num)
34
+ );
35
+
36
+ export spawn, get_num_threads, set_num_threads;
@@ -0,0 +1,12 @@
1
+ # default behavior is to always use unix style line endings
2
+ * text eol=lf
3
+ *.png binary
4
+ *.pdn binary
5
+ *.jpg binary
6
+ *.sln binary
7
+ *.suo binary
8
+ *.vcproj binary
9
+ *.patch binary
10
+ *.dll binary
11
+ *.lib binary
12
+ *.exe binary