From b8446c868707ac1b86b482aac03002a2b585dbb6 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 24 Jan 2025 10:45:22 -0500 Subject: branching, if-else-then; test arm compile --- foci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'foci.c') diff --git a/foci.c b/foci.c index 9c73a04..2ca054f 100644 --- a/foci.c +++ b/foci.c @@ -101,7 +101,13 @@ W(colon, ":", &w_align) FTH(here), LIT(0), comma, FTH(latest), comma, poke, comp, END I(semic, ";", &w_colon) LIT(fexit), comma, LIT(&latest), poke, intr, END I(literal, "literal", &w_semic) LIT(push), comma, comma, END -#define LATEST &w_literal +N(b, "_b", &w_literal) { ++pp; pp = (intptr_t **)*pp; NEXT; } +N(bz, "_bz", &w_literal) { ++pp; if (!*sp++) { pp = (intptr_t **)*pp; } NEXT; } +I(fif, "if", &w_b) LIT(bz), comma, FTH(here), LIT(0), comma, END +I(then, "then", &w_fif) FTH(here), LIT(sizeof(intptr_t)), sub, swap, poke, END +I(felse, "else", &w_then) LIT(b), comma, FTH(here), LIT(0), comma, swap, + FTH(here), LIT(sizeof(intptr_t)), sub, swap, poke, END +#define LATEST &w_felse void call(void *ptr) { -- cgit v1.2.3