]> git.eli173.com Git - klapaucius/commitdiff
committing now to run on different machine
authorElijah Cohen <eli@eli173.com>
Wed, 14 Aug 2024 19:43:55 +0000 (14:43 -0500)
committerElijah Cohen <eli@eli173.com>
Wed, 14 Aug 2024 19:43:55 +0000 (14:43 -0500)
ideas.org
src/eval.c
src/test.c

index fdf7d0d60fc95e91406fcbbcbb5246ec7deb5872..1f8dd5056f4fd4d8f789e87de687a487c22fa5fa 100644 (file)
--- a/ideas.org
+++ b/ideas.org
@@ -1,3 +1,16 @@
+MEMORY MANAGEMENT
+okay gonna start with making sure the parser is good... how?
+
+let's think about every single allocation needed for some statements:
+(+ 4 6)
+eval structure:
+
+
+
+==================
+
+
+
 rewrite eq for quote? perhaps
 
 how do i deal with when/where things get unquoted? really hard to say...
index cb99014e490d10bfdb1396b14e61e47eb64b44f3..f5f25632b56fb68193b3111bf81b135d90a75f00 100644 (file)
@@ -10,7 +10,7 @@
 Sexpr* apply_builtin(Sexpr* func, Sexpr* arg, Sexpr* env);
 
 Sexpr* eval(Sexpr* s, Sexpr* dict) {
-       printf("s: %s\n", sprint_sexpr(s));
+       //printf("s: %s\n", sprint_sexpr(s));
        // non-null s
        // generally assumes that a sexpr passed to this is well-formed (ie no inapt NULLS)
        // question: does a completed builtin get evaluated here?
index 52ade20370fd6e334348aa7b34436283c5d633a1..268d79ef7106888d85f505f6f630d072944e22d6 100644 (file)
@@ -7,7 +7,7 @@
 #include "parser.h"
 #include "dict.h"
 #include "eval.h"
-
+#include "builtins.h"
 
 
 void test_basics() {
@@ -83,18 +83,40 @@ void test_dict() {
        d = append_to_dict(d, from_sym("asdf"), from_uint(544));
        printf("lookup hello: %s\n", sprint_sexpr(lookup(d, from_sym("hello"))));
        printf("lookup asdf: %s\n", sprint_sexpr(lookup(d, from_sym("asdf"))));
+}
 
-
+void mem_parser() {
+       printf("starting parser memory testing\n");
+       char* toparse = "(car (cons 1 (cons 2 nil)))";
+       Sexpr* parsed;
+       while(1) {
+               parsed = parse(toparse);
+               sexpr_free(parsed);
+       }
 }
 
+void mem_hammer() {
+       unsigned long i = 0;
+       Sexpr* env = init_dict();
+       load_env(env);
+       char* eternalcmd = "(car (cons 1 (cons 2 nil)))";
+       while(true) {
+               Sexpr* p = parse(eternalcmd);
+               eval(car(p), env);
+               printf("%lu\n", i);
+               i++;
+       }
+}
 
 void run_tests(){
-       test_basics();
-       test2();
-       test_parsing();
-       test_parser();
-       test_eq();
-       test_dict();
+       mem_parser();
+       //mem_hammer();
+       //test_basics();
+       //test2();
+       //test_parsing();
+       //test_parser();
+       //test_eq();
+       //test_dict();
 }
 
 int main() {