Commit Graph
7 Commits
Author SHA1 Message Date
waozi c9b8e27e4c Canonicalize widget API 2026-08-09 19:52:01 -03:00
waozi d07078d2b2 Move UI runtime to declarative nodes 2026-08-06 07:15:55 -03:00
waozi 63a8c366a2 Finish removing Kry sugar verbs — language is now minimal
The previous pass removed the redundant call/assignment verbs (draw,
native, set, widget) and the widget keywords (text/rect/line/background/
swatch). This pass removes the remaining bespoke sugar so the statement
language is just declarations, assignments, calls, and control flow:

Removed (now fatal errors with migration hints):
- advance x by N   -> x += N
- clamp_min/max x N -> if (x < N) x = N
- c_rect name = .. -> name: Rectangle = (Rectangle){..}
- texture name = .. -> name: Texture2D = ..
- set_theme id mode -> SetCurrentTheme(id, mode)
- button label {..} -> if WidgetButton(x, y, w, h, label, style) {..}
- on key K {..}     -> if (UIKeyPressed(K)) {..}
- on key_down K {..}-> if (UIKeyDown(K)) {..}
- event/on expr {..}-> if (expr) {..}
- icon_button .. {..}-> if DrawUIIconButton((UIIconButton){..}) {..}

Also moved the background/set_theme fatal-error arms ahead of the
line_is_c_uninit_decl heuristic in the dispatcher, since the heuristic
was swallowing them as bogus 'TYPE NAME' C declarations.

What remains in parse_statement: control flow (if/else/for/while/switch/
case/default/guard/return/break/continue/goto/labels), declarations
(name :=, name: T =), assignments (incl. compound), bare calls, enum,
and the two escape hatches (c, unused). Rewrote the 9 example files that
used button/on-key (22 sites). Extended kc_syntax_test.sh to assert each
removed sugar keyword now errors. make clean && make all test passes.

KRY_LANGUAGE_PLAN.md updated to document the final minimal statement set.
2026-07-25 17:04:29 -05:00
waozi 236ea20a1a Remove redundant Kry verbs; widgets are now a library
The Kry statement language had a tangle of overlapping verbs (draw,
native, set, widget, text, rect, line, background, swatch) that all did
minor variants of the same thing: emit a call or assignment statement.
This removes the redundant ones and replaces the widget keywords with an
ordinary library of functions, so 'widget' is a convention (a function
that draws) rather than compiler syntax.

Removed statement verbs (now fatal errors with a migration hint):
- draw / widget  -> call the expression directly; bare call statements
  already wrap with PushUIInspectSource/PopUIInspectSource, so
  click-to-source keeps working with no keyword.
- native         -> call the expression directly.
- set            -> write the assignment/call directly.
- text/rect/line/background/swatch -> call the matching Widget* library
  function (WidgetText, WidgetRect, WidgetLine, WidgetBackground).

Kept keywords earn their place: button, on/event, icon_button,
set_theme, advance, clamp_min/max, c_rect, texture, c, unused, and all
control flow.

New widget library (include/ui_widgets.h, src/ui/ui_widgets.c):
WidgetText, WidgetRect, WidgetLine, WidgetBackground, WidgetButton —
ordinary C functions wrapping the existing DrawUI* primitives, with the
same defaults the removed keywords used. Included via kryon.h.

Rewrote all 17 example .kry files to the verb-free syntax (positional
args; named args deferred to a later phase since kc has no parameter
table). Updated kc_syntax_test.sh: the 'valid' screen and cross-file
tests no longer use removed verbs, and new tests assert that each
removed verb errors with a migration message.

Regenerated icon assets pick up the freebsd/macos platform PNGs added
earlier.

make clean && make all test passes (kc syntax, raylib compat, runtime).
2026-07-25 12:54:52 -05:00
waozi 93913f12a3 Improve Kry language and generic APIs 2026-07-23 13:44:45 -03:00
waozi bd4a4b1948 Make Kry C imports explicit 2026-07-21 19:26:09 -03:00
waozi 6a79813efa Build out Kryon IDE workflow 2026-07-20 23:14:07 -03:00