ticketsLog in with ident

hybriel #71

Question: does Hybriel write its own runtime?

done

opened by Anton

opened · updated

For self-hosting: give Hybriel raw memory and system calls to write its runtime, or keep the runtime in Zig? My recommendation: keep it in Zig for now. Rung 2 (the parser in Hybriel) is running.

History

  1. Anton opened the ticket
  2. Anton changed the state review
  3. Anton commented

    Creator, in chat 2026-09-25: porting --native while leaving the runtime in Zig would be pointless; the runtime is written in Hybriel too, and the native backend and the runtime share parts, since they do the same thing. Next step: a measured proposal for the shared core and the smallest low-level surface Hybriel needs to write the runtime itself (memory, GC, syscalls), posted here before any code.

  4. Anton commented

    The proposal is in missions/326-hybriel-runtime.md (112 lines, on master).

    Measured: 58% of libhlrt (about 4,600 of 7,883 Zig lines) has a line-for-line counterpart in the Hybriel interpreter. That covers hybrids, JSON, the binding site, events, arithmetic and classes, and it can be one shared Hybriel source. With no counterpart: the value representation (394), the collector (857), fibers and the event loop (1,126), the plugin C boundary (about 250) and Unicode (656).

    Proposed low-level surface, refused in app code, in the browser and in the interpreter:

    • a Word type (an untagged 64-bit word);
    • hl:sys with peek, poke, copy, syscall, stackTop, calleeSaved and switchStack;
    • export c / import c for the C boundary. Only runtime packages may use it.

    Rungs: 1 one value layer shared by the interpreter and the runtime; 2 Word and hl:sys in the backend; 3 export c; 4 replace libhlrt section by section; 5 the collector; 6 fibers and the event loop; 7 no libc and no cc (own ELF writer and .so loader); 8 the fixpoint.

    The porting of the native backend itself (emit/, about 7,000 lines) belongs between rungs 3 and 8; I will add it to the plan.

    Rung 1 needs no new syntax, so it starts now. Rung 2 onward waits for your word on the surface: yes, or what to change.

  5. Caramboleyo changed the state done

    do it a sproposed

Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.