From 954f79db55ed4bd0349907d7b580ec5205e5e295 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sat, 12 Jul 2025 09:49:27 +0200 Subject: Boostrap: Implement import --- examples/0.pry | 74 +++------------------------------------------------------- 1 file changed, 3 insertions(+), 71 deletions(-) (limited to 'examples/0.pry') diff --git a/examples/0.pry b/examples/0.pry index a31ab63..9559973 100644 --- a/examples/0.pry +++ b/examples/0.pry @@ -1,80 +1,12 @@ /* HELLO! Welcome to the unnamed language */ -extern printf = (*i8, varargs) => void; -extern exit = (i64) => void; - -let strcmp = (stra: *i8, strb: *i8) => bool { - let i = 0; - while i < 10 { - printf("I: %d\n", i); /* CONTINUE */ - let ca = (*(stra + cast(*i8, i))); - i = i + 1; - }; - - return true; -}; - -let isdigit = (c: i8) => bool { - if c >= '0' { - if c <= '9' { - return true; - }; - }; - return false; -}; - -let isalpha = (c: i8) => bool { - if c >= 'a' { - if c <= 'z' { - return true; - }; - }; - if c >= 'A' { - if c <= 'Z' { - return true; - }; - }; - return false; -}; - -let isalphanum = (c: i8) => bool { - if isalpha(c) { - return true; - }; - if isdigit(c) { - return true; - }; - - return false; -}; - -let iswhitespace = (c: i8) => bool { - if c == ' ' { - return true; - }; - - if c >= '\t' { - if c <= '\r' { - return true; - }; - }; - - return false; -}; - -let assert = (cond: bool) => void { - if !cond { - printf("ASSERTION FAILED\n"); - exit(1); - }; - - return; -}; +import "!stdlib.pry"; let main = (argc: i64, argv: *i64) => i64 { printf("%d\n", argc); isdigit('a'); - strcmp("a", "b"); + let x = strcmp("a", "a"); + printf("%d\n", x); return 2; }; -- cgit 1.4.1