all repos — hex @ 7702b7d229d6d5f69d7dff3c0baa7773350fa075

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

Fixes.
h3rald h3rald@h3rald.com
Sat, 28 Dec 2024 06:05:11 +0000
commit

7702b7d229d6d5f69d7dff3c0baa7773350fa075

parent

22152c26c21cccd898921f92ac7e2a03f639a7ed

4 files changed, 13 insertions(+), 10 deletions(-)

jump to
M scripts/test.hexscripts/test.hex

@@ -4,7 +4,6 @@ 0x0 "test-count" :

0x0 "successes" : 0x0 "failures" : () "errors" : -errors puts () "fails" : 0x0 "result" :

@@ -96,13 +95,13 @@ ("hello" " world" cat "hello world" ==)

;36 - ;((0x1 "a") ("b") cat (0x1 "a" "b") ==) + ((0x1 "a") ("b") cat (0x1 "a" "b") ==) ((0x1 0x3 puts "aaa") len 0x4 ==) ((0x2 0x3 0x4) 0x2 get 0x4 ==) ("abcde" 0x1 get "b" ==) ;40 - ;("a/b/c" "t-path" : (t-path "/" index 0x0 >=) (t-path "/" "\\" replace "t-path" :) while t-path "a\\b\\c" == "t-path" #) + ("a/b/c" "t-path" : (t-path "/" index 0x0 >=) (t-path "/" "\\" replace "t-path" :) while t-path "a\\b\\c" == "t-path" #) ("assets\"" "\"" "/" replace "assets/" ==) (("" () cat) (error) try "[symbol cat] Two quotations or two strings required" ==) ((0x4 len) (error) try "[symbol len] Quotation or string required" ==)

@@ -114,14 +113,14 @@ ("abc" "d" index 0xffffffff ==)

(("0" "0" "0" "0") "." join "0.0.0.0"==) ;48 - ;("0.0.0.0" "." split ("0" "0" "0" "0") ==) - ;("Hello, World!" "Hello" "Goodbye" replace "Goodbye, World!" ==) - ;("test" "test.txt" write "test.txt" read "test" ==) - ;("!" "test.txt" append "test.txt" read "test!" ==) + ("0.0.0.0" "." split ("0" "0" "0" "0") ==) + ("Hello, World!" "Hello" "Goodbye" replace "Goodbye, World!" ==) + ("test" "test.txt" write "test.txt" read "test" ==) + ("!" "test.txt" append "test.txt" read "test!" ==) ;52 - ;("rm test.txt" exec 0x0 ==) - ;("rm test.txt" run 0x0 get 0x1 ==) + ("rm test.txt" exec 0x0 ==) + ("rm test.txt" run 0x0 get 0x1 ==) ("ls web/contents" run 0x1 get "\n" split len 0x7 ==) (args 0x1 get "scripts/test.hbx" ==) ;56
M src/interpreter.csrc/interpreter.c

@@ -80,6 +80,7 @@ }

if (result != 0) { + hex_error(ctx, "[interpret] Unable to push: %s", token->value); hex_free_token(token); print_stack_trace(ctx); return result;
M src/registry.csrc/registry.c

@@ -105,7 +105,9 @@ for (size_t i = 0; i < ctx->registry->size; i++)

{ if (strcmp(ctx->registry->entries[i]->key, key) == 0) { + hex_debug(ctx, "LOOK: %s", key); *result = *ctx->registry->entries[i]->value; + //hex_debug_item(ctx, "DONE: ", result); return 1; } }
M src/stack.csrc/stack.c

@@ -51,6 +51,7 @@ }

} else { + hex_debug_item(ctx, "Value: ", value); result = hex_push(ctx, value); } }

@@ -133,13 +134,13 @@ }

hex_item_t *hex_quotation_item(hex_context_t *ctx, hex_item_t **quotation, size_t size) { - (void)(ctx); hex_item_t *item = malloc(sizeof(hex_item_t)); if (item == NULL) { hex_error(ctx, "[create quotation] Failed to allocate memory for item"); return NULL; } + item->operator = 0; item->type = HEX_TYPE_QUOTATION; item->data.quotation_value = quotation; item->quotation_size = size;