Skip to content

Add file embedding and multi-column SQLite support#8

Merged
cs01 merged 11 commits intomainfrom
demo-server
Feb 19, 2026
Merged

Add file embedding and multi-column SQLite support#8
cs01 merged 11 commits intomainfrom
demo-server

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Feb 19, 2026

Summary

Language & API improvements

  • SQLite: sqlite.get() and sqlite.all() now return all columns pipe-separated (e.g., "1|Alice") with a new __sqlite_row_to_string helper
  • fs.statSync(): isFile and isDirectory are now methods (.isFile()) for Node.js compatibility; fixed path.join() behavior
  • Compile-time file embedding: New ChadScript.embedFile(), embedDir(), and getEmbeddedFile() for bundling static assets into binaries
  • fix path.resolve to join all arguments before calling realpath

Build & tooling

  • Cross-compilation support for different target architectures
  • argparse subcommands: Added subcommand support; migrated chad-native.ts to use it
  • HTTP server: Content-type detection from file extensions (.css, .js, .json, .html, .svg, .png, .jpg, .woff2, .wasm)
  • CI improvements: Added --target-cpu flag; default to x86-64 in CI to fix SIGILL on runners

Examples & other

  • New Hacker News example app demonstrating embedded files and HTTP routing
  • Added query and parallel example programs
  • Installer updates (color escapes, linker flags for macOS SDK)

All tests pass; self-hosting verified.

@cs01 cs01 force-pushed the demo-server branch 2 times, most recently from 48a4ee8 to 155319f Compare February 19, 2026 06:22
@cs01 cs01 merged commit a7392b3 into main Feb 19, 2026
11 checks passed
@cs01 cs01 deleted the demo-server branch February 19, 2026 15:52
@cs01 cs01 mentioned this pull request Feb 26, 2026
cs01 added a commit that referenced this pull request Apr 19, 2026
…ields

closes dapweb NOTES #8 'Blocker': JSON.parse<T> with arrays emitted broken
IR and, when that was fixed, produced wrong values at runtime. two bugs
really, both rooted in a single architectural choice:

1. tryHandleGlobalJSONParse tagged the typed result with SymbolKind_JSON.
   downstream member access treated the variable as a yyjson lazy handle
   and emitted csyyjson_obj_get(%T* as i8*, "field") — bogus pointer
   reads for any field except primitives. the 'two truths' problem: the
   struct was populated correctly at parse time but ignored.

2. the parser itself emitted @parse_json_number[] for nested T[] fields —
   unmangled TS type tokens leaking into LLVM IR as function names.

fix (direction A, drop lazy metadata on typed parse):
- tryHandleGlobalJSONParse now tags with SymbolKind_Object. member access
  uses struct-GEP exclusively. the yyjson-lazy path is scoped to bare
  JSON.parse(s) — which is already a compile error in ChadScript, so the
  lazy path is effectively unreachable from user code now.
- generateJsonParser for number[] / string[] fields materializes the
  %Array* / %StringArray* inline via csyyjson_arr_* into the struct slot,
  matching the runtime layout expected by .length and for-of.
- T[] for user-defined T rejects with a clear 'not yet supported' error
  (no more broken @parse_json_T[] call).

unblocks typed parsing of realistic DAP responses (stackTrace, scopes,
variables, setBreakpoints, evaluate, stopped events — all have nested
arrays). dapweb can drop its homegrown extractField walker.
cs01 added a commit that referenced this pull request Apr 19, 2026
…ields (#554)

closes dapweb NOTES #8 'Blocker': JSON.parse<T> with arrays emitted broken
IR and, when that was fixed, produced wrong values at runtime. two bugs
really, both rooted in a single architectural choice:

1. tryHandleGlobalJSONParse tagged the typed result with SymbolKind_JSON.
   downstream member access treated the variable as a yyjson lazy handle
   and emitted csyyjson_obj_get(%T* as i8*, "field") — bogus pointer
   reads for any field except primitives. the 'two truths' problem: the
   struct was populated correctly at parse time but ignored.

2. the parser itself emitted @parse_json_number[] for nested T[] fields —
   unmangled TS type tokens leaking into LLVM IR as function names.

fix (direction A, drop lazy metadata on typed parse):
- tryHandleGlobalJSONParse now tags with SymbolKind_Object. member access
  uses struct-GEP exclusively. the yyjson-lazy path is scoped to bare
  JSON.parse(s) — which is already a compile error in ChadScript, so the
  lazy path is effectively unreachable from user code now.
- generateJsonParser for number[] / string[] fields materializes the
  %Array* / %StringArray* inline via csyyjson_arr_* into the struct slot,
  matching the runtime layout expected by .length and for-of.
- T[] for user-defined T rejects with a clear 'not yet supported' error
  (no more broken @parse_json_T[] call).

unblocks typed parsing of realistic DAP responses (stackTrace, scopes,
variables, setBreakpoints, evaluate, stopped events — all have nested
arrays). dapweb can drop its homegrown extractField walker.

Co-authored-by: cs01 <cs01@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant