diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-06-01 01:05:15 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-06-01 01:05:15 +0330 |
commit | 2bc938b62a27c52666c2ac6787c468b66aa21553 (patch) | |
tree | 0782dc583f529ce512ad19c8aab9f6ed00f73e04 | |
parent | 6f89805452feaa239ed6d662762ac7e17b7a7287 (diff) |
add println
fix @neg type
-rw-r--r-- | code/lib/io.felan | 9 | ||||
-rw-r--r-- | code/main.felan | 10 | ||||
-rw-r--r-- | src/runner/runner.c | 4 |
3 files changed, 12 insertions, 11 deletions
diff --git a/code/lib/io.felan b/code/lib/io.felan index ff697e2..c486902 100644 --- a/code/lib/io.felan +++ b/code/lib/io.felan @@ -5,6 +5,15 @@ libc :: @c_library("/usr/lib/libc.so.6"); puts :: @c_function(libc,"puts",(*u8)->i32); putchar :: @c_function(libc,"putchar",(i32)->void); +println :: () -> void { + print_char('\n'); +}; + +println :: (value:anytype) -> void { + print(value); + print_char('\n'); +}; + print :: (value:string) -> void { i := 0; while i < @cast(value.length,i64) { diff --git a/code/main.felan b/code/main.felan index f420f64..fca48b0 100644 --- a/code/main.felan +++ b/code/main.felan @@ -1,14 +1,6 @@ @import("basic.felan"); -st :: struct { -}; - -__get_item__ :: (left:st,index:i64,index2:i64)->i64{ - return index+index2; -}; - main :: () -> void { - a := "abcdef"; - print(a); + println(@cast(-1,i32)); }; diff --git a/src/runner/runner.c b/src/runner/runner.c index d493236..23b6d7e 100644 --- a/src/runner/runner.c +++ b/src/runner/runner.c @@ -303,7 +303,7 @@ AstTree *runAstTreeBuiltin(AstTree *tree, AstTreeScope *scope, default: UNREACHABLE; } - return newAstTree(AST_TREE_TOKEN_RAW_VALUE, ret, copyAstTree(left), NULL, + return newAstTree(AST_TREE_TOKEN_RAW_VALUE, ret, copyAstTree(left->type), NULL, NULL); } case AST_TREE_TOKEN_BUILTIN_ADD: { @@ -2345,7 +2345,7 @@ AstTree *castTo(AstTree *tree, AstTree *to) { case AST_TREE_TOKEN_TYPE_C_LIBRARY: case AST_TREE_TOKEN_TYPE_C_FUNCTION: } - printLog("%s", AST_TREE_TOKEN_STRINGS[tree->token]); + printLog("%s", AST_TREE_TOKEN_STRINGS[tree->type->token]); UNREACHABLE; } |