From 786d85463a3b8ec57aef3df2336f6c72bd0aa250 Mon Sep 17 00:00:00 2001 From: sam Date: Sun, 21 Jul 2024 02:16:36 +1200 Subject: [PATCH] rename runtime to std and update example --- example.lisp | 3 ++- src/codegen.c | 2 +- src/main.c | 4 ++-- runtime/runtime.c => std/std.c | 2 +- runtime/runtime.h => std/std.h | 0 5 files changed, 6 insertions(+), 5 deletions(-) rename runtime/runtime.c => std/std.c (93%) rename runtime/runtime.h => std/std.h (100%) diff --git a/example.lisp b/example.lisp index f74d298..cc076c8 100755 --- a/example.lisp +++ b/example.lisp @@ -1 +1,2 @@ -(print_str "guh") \ No newline at end of file +(print_str "hello world") +(print_num (add 5 (divide 100 5))) \ No newline at end of file diff --git a/src/codegen.c b/src/codegen.c index 2d7e91a..9d30b9b 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -3,7 +3,7 @@ const char* codegen(ASTNode* node) { if(node->type == AST_PROGRAM) { - sl_string code = sl_string("#include \n\nint main() {\n"); + sl_string code = sl_string("#include \n\nint main() {\n"); for(sl_vec_it(n, node->body)) { sl_append_c_str(&code, codegen(*n)); sl_append_c_str(&code, ";\n"); diff --git a/src/main.c b/src/main.c index 45b3215..4197982 100644 --- a/src/main.c +++ b/src/main.c @@ -32,8 +32,8 @@ int main(int argc, char* argv[]) { TCCState* state = tcc_new(); assert(tcc_set_output_type(state, TCC_OUTPUT_EXE) == 0); tcc_set_lib_path(state, "lib/tcc"); - assert(tcc_add_include_path(state, "runtime") == 0); - assert(tcc_add_file(state, "runtime/runtime.c") == 0); + assert(tcc_add_include_path(state, "std") == 0); + assert(tcc_add_file(state, "std/std.c") == 0); assert(tcc_compile_string(state, code) == 0); assert(tcc_output_file(state, argv[2]) == 0); diff --git a/runtime/runtime.c b/std/std.c similarity index 93% rename from runtime/runtime.c rename to std/std.c index 1d09ce5..b46964a 100644 --- a/runtime/runtime.c +++ b/std/std.c @@ -1,4 +1,4 @@ -#include "runtime.h" +#include "std.h" #include int add(int a, int b) { diff --git a/runtime/runtime.h b/std/std.h similarity index 100% rename from runtime/runtime.h rename to std/std.h