From 5d47512bf56754eccfc30018a4eacb3ae022cc67 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Wed, 1 Feb 2023 20:33:04 -0800 Subject: [PATCH] Print true, false, and lists. --- implementations/C/joy.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/implementations/C/joy.c b/implementations/C/joy.c index 8cbcd2f..17f5502 100644 --- a/implementations/C/joy.c +++ b/implementations/C/joy.c @@ -161,6 +161,10 @@ text_to_expression(char *text) return result; } +/* Pre-declare so we can use it in print_node(). */ +void +print_list(struct list_node* el); + void print_node(struct JoyType j) @@ -172,6 +176,17 @@ print_node(struct JoyType j) case joySymbol: printf("%s", j.value.symbol); break; + case joyTrue: + printf("true"); + break; + case joyFalse: + printf("false"); + break; + case joyList: + printf("["); + print_list(j.value.el); + printf("]"); + break; default: printf("wtf"); }