rename runtime to std and update example
This commit is contained in:
parent
f4a08bdfbd
commit
786d85463a
5 changed files with 6 additions and 5 deletions
|
@ -1 +1,2 @@
|
|||
(print_str "guh")
|
||||
(print_str "hello world")
|
||||
(print_num (add 5 (divide 100 5)))
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
const char* codegen(ASTNode* node) {
|
||||
if(node->type == AST_PROGRAM) {
|
||||
sl_string code = sl_string("#include <runtime.h>\n\nint main() {\n");
|
||||
sl_string code = sl_string("#include <std.h>\n\nint main() {\n");
|
||||
for(sl_vec_it(n, node->body)) {
|
||||
sl_append_c_str(&code, codegen(*n));
|
||||
sl_append_c_str(&code, ";\n");
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "runtime.h"
|
||||
#include "std.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int add(int a, int b) {
|
Loading…
Add table
Reference in a new issue