1. Introduction

The Daslang standard library is a collection of modules that extend the language with commonly needed functionality — math, string manipulation, file I/O, serialization, regular expressions, AST manipulation, and more.

Some modules are implemented in C++ and are available by default (builtin, math, strings, fio, rtti, ast, network, jobque, uriparser). The rest are written in daslang itself and live in the daslib/ directory; import them with require daslib/<module_name>.

1.1. Core runtime

  • builtin — built-in runtime functions, operators, containers, smart pointers, and system infrastructure

  • math — vector and scalar math, trigonometry, noise, matrix and quaternion operations

  • math_bits — bit-level float/int/double reinterpretation helpers

  • math_boost — angle conversions, projection matrices, plane math, color packing

  • fio — file input/output, directory manipulation, process spawning

  • random — LCG-based random number generators and distributions

  • network — low-level TCP socket server

  • uriparser — URI parsing, normalization, and file-name conversion (based on UriParser)

  • uriparser_boost — URI component accessors and query-string helpers

1.2. Strings

  • strings — core string manipulation: search, slice, conversion, builder, character groups

  • strings_boost — split/join, replace, Levenshtein distance, formatting helpers

  • utf8_utils — UTF-8 encoding and decoding utilities

  • temp_strings — temporary string construction that avoids heap allocation

  • stringify%stringify~ reader macro for embedding long strings at compile time

  • base64 — Base64 encoding and decoding

1.3. Regular expressions and parsing

  • regex — regular expression matching and searching

  • regex_boost%regex~ reader macro for compile-time regex construction

  • peg — PEG parser generator: define grammars with the parse macro, compiled to packrat parsers

1.4. Reflection and AST

  • rtti — runtime type information: type queries, module/function/variable iteration, compilation and simulation

  • ast — compile-time AST access: expression/function/structure creation, visitor pattern, macro infrastructure

  • ast_boost — AST convenience helpers: queries, annotation manipulation, expression generation, visitor utilities

  • ast_block_to_loop — AST transform that converts block-based iteration to explicit loops (used by DECS)

  • ast_cursor — AST cursor navigation for walking expression trees

  • ast_used — collect all types used by a set of functions (for code generation)

  • ast_match — AST pattern matching via reverse reification: match expressions against structural patterns

  • quote — AST quasiquotation for constructing syntax trees from inline code

  • type_traits — compile-time type introspection and manipulation macros

  • typemacro_boost — type macro and template structure support infrastructure

  • dynamic_cast_rtti — runtime dynamic casting between class hierarchies

  • debugapi — debug agent API: breakpoints, stepping, variable inspection, data walkers

1.5. Functional and algorithms

  • functional — higher-order functions: filter, map, reduce, any, all, flatten, sorted

  • algorithm — binary search, topological sort, set operations on tables, array utilities

  • sort_boost — custom comparator support for the built-in sort

  • linq — LINQ-style query operations: select, where, order, group, join, aggregate, set operations

  • linq_boost — macro support for LINQ query syntax

1.6. Data structures

  • flat_hash_table — open-addressing flat hash table template

  • cuckoo_hash_table — cuckoo hash table with O(1) worst-case lookup

  • bool_array — packed boolean array (BoolArray) backed by uint[] storage

  • soa — Structure of Arrays transformation for cache-friendly data layout

1.7. Serialization and data

  • archive — general-purpose binary serialization framework with Serializer / Archive pattern

  • json — JSON parser and writer (JsValue variant, read_json, write_json)

  • json_boost — automatic struct ↔ JSON conversion via reflection

1.8. Jobs and concurrency

  • jobque — job queue primitives: channels, job status, lock boxes, atomics

  • jobque_boostnew_job / new_thread helpers, channel iteration

  • apply_in_context — cross-context function evaluation helpers

  • async_boost — async/await coroutine macros using job queues

1.9. Macros and metaprogramming

  • templatesdecltype macro and [template] function annotation

  • templates_boost — template application helpers: variable/type replacement, hygienic names

  • macro_boost — miscellaneous macro manipulation utilities

  • contracts — function argument contract annotations ([expect_any_array], [expect_any_table], etc.)

  • applyapply reflection pattern for struct field iteration

  • enum_trait — compile-time enumeration trait queries

  • constexpr — constant expression detection and substitution macro

  • bitfield_boost — operator overloads for bitfield types

  • bitfield_trait — reflection utilities for bitfield names and values

  • consumeconsume pattern for move-ownership argument passing

  • generic_return[generic_return] annotation for return type instantiation

  • remove_call_args — AST transformation to remove specified call arguments

  • class_boost — macros for extending class functionality and method binding

1.10. Control flow macros

  • deferdefer and defer_delete — execute code at scope exit

  • delegate[delegate] annotation for forwarding method calls

  • if_not_nullif_not_null safe-access macro

  • safe_addrsafe_addr and temp_ptr — safe temporary pointer macros

  • static_letstatic_let — variables initialized once and persisted across calls

  • lpipe — left-pipe operator macro (<|)

  • is_localis_local_expr / is_scope_expr AST query helpers

  • assert_onceassert_once — assertion that fires only on first failure

  • unroll — compile-time loop unrolling macro

  • instance_function[instance_function] annotation for struct method binding

  • array_boosttemp_array, array_view, and empty helpers

1.11. Pattern matching

  • matchmatch macro for structural pattern matching on variants and values

1.12. Entity component system

  • decs — DECS (Daslang Entity Component System): archetypes, components, queries, staged updates

  • decs_boost — DECS macro support for query syntax

  • decs_state — DECS state machine support for entity lifecycle

1.13. OOP and interfaces

  • coroutines — coroutine runner (cr_run, cr_run_all) and generator macros (yield_from)

  • interfaces[interface] and [implements] annotations for interface-based polymorphism

  • cpp_bind — C++ class adapter binding code generator

1.14. Testing and debugging

  • faker — random test data generator: strings, numbers, dates

  • fuzzer — function fuzzing framework

  • profiler — instrumenting CPU profiler for function-level timing

  • profiler_boost — profiler cross-context helpers and high-level macros

  • debug_eval — runtime expression evaluation for interactive debugging

  • dap — Debug Adapter Protocol (DAP) data structures for debugger integration

1.15. Code quality and tooling

  • lint — static analysis pass for common code issues

  • validate_code — AST validation annotations for custom code checks

  • refactor — automated code refactoring transformations

1.16. Developer tools

1.17. HTTP and WebSocket

  • dashv — HTTP client/server and WebSocket bindings (C++ module, based on libhv)

  • dashv_boost — dasHV convenience helpers: GET/POST/PUT/PATCH/DELETE, response iteration

1.18. XML

  • pugixml — XML parsing, building, and XPath queries (C++ module, based on pugixml)

  • PUGIXML_boost — XML convenience helpers: node iteration, automatic struct serialization

1.19. Image

  • stbimage — image loading, saving, and pixel access (C++ module, based on stb_image)

  • stbimage_boost — image convenience helpers: drawing, blending, transforms

  • stbtruetype — TrueType font rasterization (C++ module, based on stb_truetype)

  • stbimage_ttf — font rendering helpers for stbimage surfaces

  • raster — software rasterizer: triangles, lines, circles, polygons

1.20. Audio

  • audio — audio playback, mixing, 3D spatial audio, effects (C++ module, based on miniaudio)

  • audio_boost — audio convenience helpers: sound loading, bus routing, effect chains

  • audio_wav — WAV file reading and writing

  • strudel_midi — MIDI file parsing and playback

  • strudel_sf2 — SoundFont 2 file parser for sample-based synthesis