Skip to content

jsx support#60

Merged
cs01 merged 10 commits intomainfrom
jsx
Feb 25, 2026
Merged

jsx support#60
cs01 merged 10 commits intomainfrom
jsx

Conversation

@cs01
Copy link
Owner

@cs01 cs01 commented Feb 24, 2026

JSX support, declare function FFI, and native compiler fixes

Summary

  • JSX support: Parser desugars <Tag prop={v}>child</Tag> into createElement("Tag", {prop: v}, [child]) calls. Supports attributes, expressions, fragments, nesting, and self-closing elements. 6 test fixtures cover the feature.
  • declare function FFI: Zero-cost foreign function interface via declare function syntax. Supports typed parameters (i32, i64, f32, f64, i8_ptr, etc.) that map directly to LLVM types without double conversion. Linker flags (-lm, -lpthread, etc.) are auto-detected from linked libraries.
  • Zireael TUI example: Two demo apps (examples/tui/app.tsx imperative, examples/tui/app-jsx.tsx JSX) showing a native terminal UI counter built with the Zireael C bridge.
  • Fix native compiler segfault: Removed TBAA (Type-Based Alias Analysis) metadata from all codegen load/store instructions. The TBAA hierarchy incorrectly declared double and pointer types as non-aliasing, causing LLVM -O2 to miscompile structs containing both field types. Also fixed FunctionNode struct layout mismatch in native parser creation sites, and switched declaredExternFunctions from Set<string> to string[] to fix duplicate declaration errors during self-hosting.

Test plan

  • All 241 tests pass (npm test)
  • Self-hosting Stage 0 + Stage 1 pass (npm run verify:quick)
  • declare function compiles without segfault (previously crashed at -O2)
  • JSX test fixtures: basic, attributes, expressions, fragments, nested, self-closing
  • Prettier check passes (npx prettier --check .)

@cs01 cs01 merged commit c1fa917 into main Feb 25, 2026
12 checks passed
@cs01 cs01 deleted the jsx branch February 25, 2026 02:30
@cs01 cs01 restored the jsx branch February 25, 2026 15:52
@cs01 cs01 deleted the jsx branch February 25, 2026 16:24
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