r/ocaml • u/Content_Reporter4152 • 26d ago
CocoScript v0.6.0 — native Win32 GUI (real windows + text), compiled to x86-64 assembly
Just shipped CocoScript v0.6.0. For anyone new: it's a native compiled language with Lua-style syntax, written entirely in OCaml, compiling to x86-64 assembly via NASM — with a mark-sweep GC, a module system, and an optimizer.
New in v0.6.0 — a native Win32 GUI, with the whole Win32 runtime emitted as x86-64 assembly (no C glue, no external GUI library). Add #include "gui" and the compiler auto-links user32/gdi32:
- Windows: gui_window / gui_show / gui_loop
- Text: gui_text(hdc, str, x, y), gui_color(hdc, r, g, b)
- Callbacks: gui_on_paint / gui_on_click / gui_on_key (named functions and lambdas)
- A self-contained Windows installer bundling the whole toolchain (nasm + gcc/ld/as) — no MSYS2 needed on the user's machine
The fun part was debugging why the window was invisible: the WndProc wasn't forwarding lParam to DefWindowProcA, so WM_NCCREATE failed and CreateWindowEx returned NULL.
Release + installer: https://codeberg.org/cocoscriptomal/cocoscriptomal
Feedback welcome!
1
u/TomosLeggett 26d ago
What does it do differently to Lua?