From 9563f738bd643d09527b7840dc4366e2a010154f Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Sun, 5 Feb 2023 09:50:41 -0800 Subject: [PATCH] pop --- implementations/C/KEYWORDS.txt | 1 + implementations/C/joy.c | 7 +++ implementations/C/joy.h | 1 + implementations/C/keywords.c | 81 +++++++++++++++++----------------- 4 files changed, 50 insertions(+), 40 deletions(-) diff --git a/implementations/C/KEYWORDS.txt b/implementations/C/KEYWORDS.txt index 49e719a..9556136 100644 --- a/implementations/C/KEYWORDS.txt +++ b/implementations/C/KEYWORDS.txt @@ -19,6 +19,7 @@ cons, cons dip, dip dup, dup i, i_joyfunc +pop, pop abs, def_abs anamorphism, def_anamorphism app1, def_app1 diff --git a/implementations/C/joy.c b/implementations/C/joy.c index f147ed7..5e2792f 100644 --- a/implementations/C/joy.c +++ b/implementations/C/joy.c @@ -589,6 +589,13 @@ cons(JoyListPtr stack, __attribute__((unused)) JoyListPtr expression) } +void +pop(JoyListPtr stack, __attribute__((unused)) JoyListPtr expression) +{ + pop_any(stack); +} + + void dip(JoyListPtr stack, JoyListPtr expression) { diff --git a/implementations/C/joy.h b/implementations/C/joy.h index 2ee6a3b..1cad871 100644 --- a/implementations/C/joy.h +++ b/implementations/C/joy.h @@ -64,6 +64,7 @@ void cons(JoyListPtr stack, JoyListPtr expression); void dip(JoyListPtr stack, JoyListPtr expression); void dup(JoyListPtr stack, JoyListPtr expression); void i_joyfunc(JoyListPtr stack, JoyListPtr expression); +void pop(JoyListPtr stack, JoyListPtr expression); void mul(JoyListPtr stack, JoyListPtr expression); void sub(JoyListPtr stack, JoyListPtr expression); void tdiv_q(JoyListPtr stack, JoyListPtr expression); diff --git a/implementations/C/keywords.c b/implementations/C/keywords.c index d1de34d..8b1fe13 100644 --- a/implementations/C/keywords.c +++ b/implementations/C/keywords.c @@ -58,10 +58,10 @@ keyword_hash (register const char *str, register size_t len) 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 20, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 5, 0, - 25, 5, 52, 52, 20, 0, 52, 52, 10, 5, - 0, 0, 10, 52, 0, 15, 0, 15, 5, 52, - 52, 5, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 0, 0, + 15, 5, 52, 52, 10, 5, 52, 52, 15, 10, + 0, 0, 10, 52, 0, 0, 0, 15, 0, 52, + 52, 0, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, @@ -94,7 +94,7 @@ in_word_set (register const char *str, register size_t len) { enum { - TOTAL_KEYWORDS = 32, + TOTAL_KEYWORDS = 33, MIN_WORD_LENGTH = 1, MAX_WORD_LENGTH = 12, MIN_HASH_VALUE = 1, @@ -104,25 +104,37 @@ in_word_set (register const char *str, register size_t len) static const struct dict_entry wordlist[] = { {""}, +#line 31 "KEYWORDS.txt" + {"b", def_b}, +#line 29 "KEYWORDS.txt" + {"at", def_at}, +#line 23 "KEYWORDS.txt" + {"abs", def_abs}, +#line 18 "KEYWORDS.txt" + {"cons", cons}, +#line 34 "KEYWORDS.txt" + {"ccons", def_ccons}, #line 21 "KEYWORDS.txt" {"i", i_joyfunc}, -#line 28 "KEYWORDS.txt" - {"at", def_at}, - {""}, -#line 36 "KEYWORDS.txt" +#line 33 "KEYWORDS.txt" + {"ccccons", def_ccccons}, +#line 38 "KEYWORDS.txt" + {"codireco", def_codireco}, +#line 37 "KEYWORDS.txt" {"codi", def_codi}, {""}, +#line 32 "KEYWORDS.txt" + {"binary", def_binary}, #line 30 "KEYWORDS.txt" - {"b", def_b}, - {""}, -#line 37 "KEYWORDS.txt" - {"codireco", def_codireco}, -#line 38 "KEYWORDS.txt" + {"average", def_average}, +#line 22 "KEYWORDS.txt" + {"pop", pop}, +#line 39 "KEYWORDS.txt" {"dinfrirst", def_dinfrirst}, {""}, -#line 31 "KEYWORDS.txt" - {"binary", def_binary}, -#line 40 "KEYWORDS.txt" +#line 15 "KEYWORDS.txt" + {"branch", branch}, +#line 41 "KEYWORDS.txt" {"disenstacken", def_disenstacken}, #line 19 "KEYWORDS.txt" {"dip", dip}, @@ -130,55 +142,44 @@ in_word_set (register const char *str, register size_t len) {"bool", truthy}, #line 16 "KEYWORDS.txt" {"clear", clear}, -#line 23 "KEYWORDS.txt" +#line 24 "KEYWORDS.txt" {"anamorphism", def_anamorphism}, -#line 29 "KEYWORDS.txt" - {"average", def_average}, + {""}, #line 17 "KEYWORDS.txt" {"cmp", cmp_joyfunc}, -#line 18 "KEYWORDS.txt" - {"cons", cons}, -#line 33 "KEYWORDS.txt" - {"ccons", def_ccons}, -#line 34 "KEYWORDS.txt" - {"cleave", def_cleave}, -#line 32 "KEYWORDS.txt" - {"ccccons", def_ccccons}, -#line 22 "KEYWORDS.txt" - {"abs", def_abs}, -#line 35 "KEYWORDS.txt" - {"clop", def_clop}, +#line 40 "KEYWORDS.txt" + {"dipd", def_dipd}, {""}, -#line 15 "KEYWORDS.txt" - {"branch", branch}, +#line 35 "KEYWORDS.txt" + {"cleave", def_cleave}, {""}, #line 20 "KEYWORDS.txt" {"dup", dup}, -#line 39 "KEYWORDS.txt" - {"dipd", def_dipd}, +#line 36 "KEYWORDS.txt" + {"clop", def_clop}, {""}, #line 13 "KEYWORDS.txt" {"/", tdiv_q}, {""}, {""}, -#line 27 "KEYWORDS.txt" +#line 28 "KEYWORDS.txt" {"appN", def_appN}, {""}, #line 12 "KEYWORDS.txt" {"-", sub}, {""}, {""}, -#line 26 "KEYWORDS.txt" +#line 27 "KEYWORDS.txt" {"app3", def_app3}, {""}, #line 11 "KEYWORDS.txt" {"+", add}, {""}, {""}, -#line 25 "KEYWORDS.txt" +#line 26 "KEYWORDS.txt" {"app2", def_app2}, {""}, #line 10 "KEYWORDS.txt" {"*", mul}, {""}, {""}, -#line 24 "KEYWORDS.txt" +#line 25 "KEYWORDS.txt" {"app1", def_app1}, {""}, #line 9 "KEYWORDS.txt"