refactor: spread across files

This commit is contained in:
2026-07-21 11:53:10 +02:00
parent a324252e8c
commit fb40d83244
5 changed files with 173 additions and 142 deletions
+22
View File
@@ -0,0 +1,22 @@
#include "lisp.h"
Node *lisp_function_addition(Nodes *args) {
if (args->count != 2) {
printf("'+' expects two arguments!\n");
return NULL;
}
if (args->items[0].kind != NODE_KIND_NUMBER ||
args->items[1].kind != NODE_KIND_NUMBER) {
printf("'+' can only add numbers, you specified something else!\n");
return NULL;
}
Node *node = malloc(sizeof(Node));
node->kind = NODE_KIND_NUMBER;
intptr_t a = args->items[0].as_number;
intptr_t b = args->items[1].as_number;
node->as_number = a + b;
return node;
}