aboutsummaryrefslogtreecommitdiff
path: root/src/bamboo.h
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-06-17 09:12:35 +0800
committerMistivia <i@mistivia.com>2025-06-17 09:12:35 +0800
commit6f1cfbda4a519ad8a232d126539a2732ab43c671 (patch)
treefe33602e4dd8419b216ca755ea91c63c72ffa65b /src/bamboo.h
init
Diffstat (limited to 'src/bamboo.h')
-rw-r--r--src/bamboo.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/bamboo.h b/src/bamboo.h
new file mode 100644
index 0000000..a424be6
--- /dev/null
+++ b/src/bamboo.h
@@ -0,0 +1,32 @@
+#ifndef BAMBOO_LISP_BAMBOO_H_
+#define BAMBOO_LISP_BAMBOO_H_
+
+#include <algds/hash_table.h>
+
+#include "sexp.h"
+
+typedef struct {
+ SExpVector objs;
+ String2IntHashTable symbols;
+} Bamboo;
+
+void Bamboo_init(Bamboo *self);
+SExp* Bamboo_ref(Bamboo *self, SExpRef ref);
+// TODO: Heap_gc()
+
+SExpRef new_integer(Bamboo *ctx, int64_t val);
+SExpRef new_real(Bamboo *ctx, double val);
+SExpRef new_string(Bamboo *ctx, const char *val);
+SExpRef new_symbol(Bamboo *ctx, const char *val);
+SExpRef cons(Bamboo *ctx, SExpRef car, SExpRef cdr);
+SExpRef nil(Bamboo *ctx);
+SExpRef new_list1(Bamboo *ctx, SExpRef e1);
+SExpRef new_list2(Bamboo *ctx, SExpRef e1, SExpRef e2);
+SExpRef new_list3(Bamboo *ctx, SExpRef e1, SExpRef e2, SExpRef e3);
+SExpRef new_list4(Bamboo *ctx, SExpRef e1, SExpRef e2, SExpRef e3, SExpRef e4);
+SExpRef new_list5(Bamboo *ctx, SExpRef e1, SExpRef e2, SExpRef e3, SExpRef e4, SExpRef e5);
+SExpRef new_list6(Bamboo *ctx, SExpRef e1, SExpRef e2, SExpRef e3, SExpRef e4, SExpRef e5, SExpRef e6);
+SExpRef new_list7(Bamboo *ctx, SExpRef e1, SExpRef e2, SExpRef e3, SExpRef e4, SExpRef e5, SExpRef e6, SExpRef e7);
+
+#endif
+