From af08d1888a034d2e4721444da38bc3ac2413e493 Mon Sep 17 00:00:00 2001 From: Toni Date: Wed, 15 Jul 2026 18:26:28 +0200 Subject: [PATCH] real relative imports --- Cargo.lock | 43 -------------------------------------- Cargo.toml | 6 ------ README.md | 2 ++ examples/brainfuck.zr | 2 +- examples/chip8.zr | 4 ++-- examples/curl.zr | 4 ++-- examples/euler/euler_00.zr | 2 +- examples/euler/euler_01.zr | 2 +- examples/euler/euler_02.zr | 2 +- examples/euler/euler_03.zr | 2 +- examples/euler/euler_04.zr | 2 +- examples/euler/euler_05.zr | 2 +- examples/euler/euler_06.zr | 2 +- examples/euler/euler_07.zr | 2 +- examples/euler/euler_08.zr | 2 +- examples/euler/euler_09.zr | 2 +- examples/euler/euler_10.zr | 2 +- examples/euler/euler_11.zr | 4 ++-- examples/euler/euler_12.zr | 2 +- examples/euler/euler_13.zr | 2 +- examples/euler/euler_14.zr | 2 +- examples/euler/euler_15.zr | 2 +- examples/euler/euler_16.zr | 4 ++-- examples/euler/euler_17.zr | 4 ++-- examples/euler/euler_18.zr | 4 ++-- examples/euler/euler_19.zr | 2 +- examples/euler/euler_20.zr | 4 ++-- examples/euler/euler_21.zr | 2 +- examples/fib.zr | 2 +- examples/fizzbuzz.zr | 2 +- examples/guess_number.zr | 4 ++-- examples/raylib.zr | 2 +- examples/rule110.zr | 4 ++-- examples/serve.zr | 2 +- examples/sqlite_todo.zr | 2 +- examples/udp_server.zr | 4 ++-- src/main.rs | 9 +------- src/tokenizer.rs | 38 ++++++++++++++++++++++++++------- std/containers.zr | 2 +- std/io.zr | 10 ++++++--- std/json.zr | 5 ++++- std/mem.zr | 4 ++-- std/net.zr | 2 +- std/num.zr | 2 +- std/os.zr | 8 +++---- std/str.zr | 4 ++-- test.zr | 4 ++-- 47 files changed, 101 insertions(+), 124 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c4f5e68..d0155c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,49 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "cc" -version = "1.2.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e228eec9be7c17ccb640b59b36a5cd805ea2a564a4c5e162c2f659fea30d3b96" -dependencies = [ - "find-msvc-tools", - "shlex", -] - -[[package]] -name = "find-msvc-tools" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" - -[[package]] -name = "libmimalloc-sys" -version = "0.1.49" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a45a52f43e1c16f667ccfe4dd8c85b7f7c204fd5e3bf46c5b0db9a5c3c0b8e9" -dependencies = [ - "cc", -] - -[[package]] -name = "mimalloc" -version = "0.1.52" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d4139bb28d14ad1facf21d5eb8825051b326e172d216b39f6d31df53cc97862" -dependencies = [ - "libmimalloc-sys", -] - -[[package]] -name = "shlex" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" - [[package]] name = "zern" version = "0.3.0" -dependencies = [ - "mimalloc", -] diff --git a/Cargo.toml b/Cargo.toml index 3044485..1c8b388 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,9 +3,3 @@ name = "zern" version = "0.3.0" edition = "2024" license = "BSD-2-Clause" - -[dependencies] -mimalloc = { version = "0.1.52", optional = true } - -[features] -mimalloc = ["dep:mimalloc"] diff --git a/README.md b/README.md index 7682727..b706ed6 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ A very cool language ## Syntax ```rust +include "$/io.zr" + func main[] : i64 answer := os.urandom_i64()->abs() % 100 diff --git a/examples/brainfuck.zr b/examples/brainfuck.zr index 192be86..d71ce83 100644 --- a/examples/brainfuck.zr +++ b/examples/brainfuck.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 // https://brainfuck.org/sierpinski.b diff --git a/examples/chip8.zr b/examples/chip8.zr index d60faf7..7ff66ff 100644 --- a/examples/chip8.zr +++ b/examples/chip8.zr @@ -1,6 +1,6 @@ // needs to be compiled with -m -C "-lraylib" -include "std/io.zr" -include "std/os.zr" +include "$/io.zr" +include "$/os.zr" extern InitWindow extern SetTargetFPS diff --git a/examples/curl.zr b/examples/curl.zr index c5a1eed..7311466 100644 --- a/examples/curl.zr +++ b/examples/curl.zr @@ -1,5 +1,5 @@ -include "std/io.zr" -include "std/net.zr" +include "$/io.zr" +include "$/net.zr" func main[argc: i64, argv: ptr] : i64 if argc < 2 diff --git a/examples/euler/euler_00.zr b/examples/euler/euler_00.zr index 7cc459e..3b2bbfb 100644 --- a/examples/euler/euler_00.zr +++ b/examples/euler/euler_00.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 sum := 0 diff --git a/examples/euler/euler_01.zr b/examples/euler/euler_01.zr index 6895dd0..85aed4f 100644 --- a/examples/euler/euler_01.zr +++ b/examples/euler/euler_01.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 sum := 0 diff --git a/examples/euler/euler_02.zr b/examples/euler/euler_02.zr index 0c846ee..9b8ffa5 100644 --- a/examples/euler/euler_02.zr +++ b/examples/euler/euler_02.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 sum := 0 diff --git a/examples/euler/euler_03.zr b/examples/euler/euler_03.zr index 3c2378f..e45ea2d 100644 --- a/examples/euler/euler_03.zr +++ b/examples/euler/euler_03.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 n := 600851475143 diff --git a/examples/euler/euler_04.zr b/examples/euler/euler_04.zr index 96c02ba..6866a5d 100644 --- a/examples/euler/euler_04.zr +++ b/examples/euler/euler_04.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 out := 0 diff --git a/examples/euler/euler_05.zr b/examples/euler/euler_05.zr index e2a5be5..c4a0b6f 100644 --- a/examples/euler/euler_05.zr +++ b/examples/euler/euler_05.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 out := 1 diff --git a/examples/euler/euler_06.zr b/examples/euler/euler_06.zr index ffd866e..78fb29b 100644 --- a/examples/euler/euler_06.zr +++ b/examples/euler/euler_06.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 sum_of_squares := 0 diff --git a/examples/euler/euler_07.zr b/examples/euler/euler_07.zr index eaa4fb8..d2d7a1a 100644 --- a/examples/euler/euler_07.zr +++ b/examples/euler/euler_07.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 found := 0 diff --git a/examples/euler/euler_08.zr b/examples/euler/euler_08.zr index dfdecd3..5cacd93 100644 --- a/examples/euler/euler_08.zr +++ b/examples/euler/euler_08.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 n := "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450" diff --git a/examples/euler/euler_09.zr b/examples/euler/euler_09.zr index 0c05505..9c8c9f7 100644 --- a/examples/euler/euler_09.zr +++ b/examples/euler/euler_09.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 for a in 1..1000 diff --git a/examples/euler/euler_10.zr b/examples/euler/euler_10.zr index 8bd384e..afcfa85 100644 --- a/examples/euler/euler_10.zr +++ b/examples/euler/euler_10.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 sum := 0 diff --git a/examples/euler/euler_11.zr b/examples/euler/euler_11.zr index 4eae779..b9052a1 100644 --- a/examples/euler/euler_11.zr +++ b/examples/euler/euler_11.zr @@ -1,5 +1,5 @@ -include "std/io.zr" -include "std/containers.zr" +include "$/io.zr" +include "$/containers.zr" func main[] : i64 N := 20 diff --git a/examples/euler/euler_12.zr b/examples/euler/euler_12.zr index 0518eea..4bb63fc 100644 --- a/examples/euler/euler_12.zr +++ b/examples/euler/euler_12.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func num_divisors[n: i64] : i64 end := n->isqrt() diff --git a/examples/euler/euler_13.zr b/examples/euler/euler_13.zr index 68f5cf0..5051fcb 100644 --- a/examples/euler/euler_13.zr +++ b/examples/euler/euler_13.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 n := 37107287533 + 46376937677 + 74324986199 + 91942213363 + 23067588207 + 89261670696 + 28112879812 + 44274228917 + 47451445736 + 70386486105 + 62176457141 + 64906352462 + 92575867718 + 58203565325 + 80181199384 + 35398664372 + 86515506006 + 71693888707 + 54370070576 + 53282654108 + 36123272525 + 45876576172 + 17423706905 + 81142660418 + 51934325451 + 62467221648 + 15732444386 + 55037687525 + 18336384825 + 80386287592 + 78182833757 + 16726320100 + 48403098129 + 87086987551 + 59959406895 + 69793950679 + 41052684708 + 65378607361 + 35829035317 + 94953759765 + 88902802571 + 25267680276 + 36270218540 + 24074486908 + 91430288197 + 34413065578 + 23053081172 + 11487696932 + 63783299490 + 67720186971 + 95548255300 + 76085327132 + 37774242535 + 23701913275 + 29798860272 + 18495701454 + 38298203783 + 34829543829 + 40957953066 + 29746152185 + 41698116222 + 62467957194 + 23189706772 + 86188088225 + 11306739708 + 82959174767 + 97623331044 + 42846280183 + 55121603546 + 32238195734 + 75506164965 + 62177842752 + 32924185707 + 99518671430 + 73267460800 + 76841822524 + 97142617910 + 87783646182 + 10848802521 + 71329612474 + 62184073572 + 66627891981 + 60661826293 + 85786944089 + 66024396409 + 64913982680 + 16730939319 + 94809377245 + 78639167021 + 15368713711 + 40789923115 + 44889911501 + 41503128880 + 81234880673 + 82616570773 + 22918802058 + 77158542502 + 72107838435 + 20849603980 + 53503534226 diff --git a/examples/euler/euler_14.zr b/examples/euler/euler_14.zr index e1591cb..7e65536 100644 --- a/examples/euler/euler_14.zr +++ b/examples/euler/euler_14.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func collatz_num[n: i64] : i64 if n % 2 == 0 diff --git a/examples/euler/euler_15.zr b/examples/euler/euler_15.zr index 789de35..63d1d77 100644 --- a/examples/euler/euler_15.zr +++ b/examples/euler/euler_15.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 n := 40 diff --git a/examples/euler/euler_16.zr b/examples/euler/euler_16.zr index 547b041..81b66ac 100644 --- a/examples/euler/euler_16.zr +++ b/examples/euler/euler_16.zr @@ -1,5 +1,5 @@ -include "std/io.zr" -include "std/containers.zr" +include "$/io.zr" +include "$/containers.zr" func main[] : i64 n := [1] diff --git a/examples/euler/euler_17.zr b/examples/euler/euler_17.zr index 2ed1734..415d9b0 100644 --- a/examples/euler/euler_17.zr +++ b/examples/euler/euler_17.zr @@ -1,5 +1,5 @@ -include "std/io.zr" -include "std/containers.zr" +include "$/io.zr" +include "$/containers.zr" func main[] : i64 s1 := [0, 3, 3, 5, 4, 4, 3, 5, 5, 4] diff --git a/examples/euler/euler_18.zr b/examples/euler/euler_18.zr index b91ee93..75f9733 100644 --- a/examples/euler/euler_18.zr +++ b/examples/euler/euler_18.zr @@ -1,5 +1,5 @@ -include "std/io.zr" -include "std/containers.zr" +include "$/io.zr" +include "$/containers.zr" func findmax[triangle: Array, row: i64, col: i64] : i64 if row == 14 diff --git a/examples/euler/euler_19.zr b/examples/euler/euler_19.zr index 5078545..c087af2 100644 --- a/examples/euler/euler_19.zr +++ b/examples/euler/euler_19.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func days[y: i64, m: i64] : i64 if m == 2 diff --git a/examples/euler/euler_20.zr b/examples/euler/euler_20.zr index c0c2d8d..50b517b 100644 --- a/examples/euler/euler_20.zr +++ b/examples/euler/euler_20.zr @@ -1,5 +1,5 @@ -include "std/io.zr" -include "std/containers.zr" +include "$/io.zr" +include "$/containers.zr" func multiply[n: Array, x: i64] : void carry := 0 diff --git a/examples/euler/euler_21.zr b/examples/euler/euler_21.zr index 35bbce4..0df250c 100644 --- a/examples/euler/euler_21.zr +++ b/examples/euler/euler_21.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func divisors_sum[n: i64] : i64 k := n diff --git a/examples/fib.zr b/examples/fib.zr index d45650f..2bb3eff 100644 --- a/examples/fib.zr +++ b/examples/fib.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 a := 0 diff --git a/examples/fizzbuzz.zr b/examples/fizzbuzz.zr index 6118691..d082864 100644 --- a/examples/fizzbuzz.zr +++ b/examples/fizzbuzz.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "$/io.zr" func main[] : i64 for i in 1..40 diff --git a/examples/guess_number.zr b/examples/guess_number.zr index 21ca36d..b5ab485 100644 --- a/examples/guess_number.zr +++ b/examples/guess_number.zr @@ -1,5 +1,5 @@ -include "std/io.zr" -include "std/os.zr" +include "$/io.zr" +include "$/os.zr" func main[] : i64 answer := os.urandom_i64()->abs() % 100 diff --git a/examples/raylib.zr b/examples/raylib.zr index 3061855..62b0c2e 100644 --- a/examples/raylib.zr +++ b/examples/raylib.zr @@ -1,5 +1,5 @@ // needs to be compiled with -m -C "-lraylib" -include "std/io.zr" +include "$/io.zr" extern InitWindow extern SetTargetFPS diff --git a/examples/rule110.zr b/examples/rule110.zr index 6ce2638..f6b7c16 100644 --- a/examples/rule110.zr +++ b/examples/rule110.zr @@ -1,5 +1,5 @@ -include "std/io.zr" -include "std/containers.zr" +include "$/io.zr" +include "$/containers.zr" func rule110_step[state: Array] : void new_state := [] diff --git a/examples/serve.zr b/examples/serve.zr index 00a0ba0..264a3a4 100644 --- a/examples/serve.zr +++ b/examples/serve.zr @@ -1,5 +1,5 @@ // needs to be compiled with -m -C "-lpthread" -include "std/net.zr" +include "$/net.zr" extern pthread_create extern pthread_detach diff --git a/examples/sqlite_todo.zr b/examples/sqlite_todo.zr index 91b86e5..1330288 100644 --- a/examples/sqlite_todo.zr +++ b/examples/sqlite_todo.zr @@ -1,5 +1,5 @@ // needs to be compiled with -m -C "-lsqlite3" -include "std/io.zr" +include "$/io.zr" extern sqlite3_open extern sqlite3_exec diff --git a/examples/udp_server.zr b/examples/udp_server.zr index aaa6949..4e41323 100644 --- a/examples/udp_server.zr +++ b/examples/udp_server.zr @@ -1,5 +1,5 @@ -include "std/io.zr" -include "std/net.zr" +include "$/io.zr" +include "$/net.zr" func main[] : i64 s, ok := net.create_udp_server("127.0.0.1", 8000) diff --git a/src/main.rs b/src/main.rs index 078d40f..685ed36 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,16 +7,11 @@ mod typechecker; use std::{ collections::HashSet, fs, - path::Path, process::{self, Command}, }; use tokenizer::ZernError; -#[cfg(feature = "mimalloc")] -#[global_allocator] -static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; - fn compile_file(args: Args) -> Result<(), ZernError> { let source = match fs::read_to_string(&args.path) { Ok(x) => x, @@ -26,10 +21,8 @@ fn compile_file(args: Args) -> Result<(), ZernError> { } }; - let filename = Path::new(&args.path).file_name().unwrap().to_str().unwrap(); - let mut included_paths = HashSet::new(); - let tokenizer = tokenizer::Tokenizer::new(filename.to_owned(), source, &mut included_paths); + let tokenizer = tokenizer::Tokenizer::new(args.path, source, &mut included_paths); let parser = parser::Parser::new(tokenizer.tokenize()?); let statements = parser.parse()?; diff --git a/src/tokenizer.rs b/src/tokenizer.rs index fb4eabb..6d41ee9 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -449,28 +449,40 @@ impl<'a> Tokenizer<'a> { self.include_file(path) } - fn include_file(&mut self, path: String) -> Result<(), ZernError> { - let canonical = match fs::canonicalize(&path) { + fn include_file(&mut self, mut path: String) -> Result<(), ZernError> { + if path.starts_with("$/") { + path = find_std_path() + .join(&path[2..]) + .to_string_lossy() + .into_owned(); + } + + let base_dir = Path::new(&self.loc.filename).parent().unwrap(); + let resolved_path = base_dir.join(&path); + + let canonical = match fs::canonicalize(&resolved_path) { Ok(p) => p, Err(e) => { return error!(self.loc, format!("failed to resolve {}: {}", path, e)); } }; - if !self.included_paths.insert(canonical) { + if !self.included_paths.insert(canonical.clone()) { return Ok(()); } - let source = match fs::read_to_string(&path) { + let source = match fs::read_to_string(&canonical) { Ok(x) => x, Err(_) => { return error!(self.loc, format!("failed to include {}", path)); } }; - let filename = Path::new(&path).file_name().unwrap().to_str().unwrap(); - - let tokenizer = Tokenizer::new(filename.to_owned(), source, &mut *self.included_paths); + let tokenizer = Tokenizer::new( + canonical.to_string_lossy().into_owned(), + source, + &mut *self.included_paths, + ); self.tokens.extend(tokenizer.tokenize()?); self.tokens.pop(); // remove inner Eof @@ -550,3 +562,15 @@ impl<'a> Tokenizer<'a> { self.current >= self.source.len() } } + +fn find_std_path() -> PathBuf { + let path = std::env::current_exe().unwrap(); + + for dir in path.ancestors() { + let candidate = dir.join("std"); + if candidate.is_dir() { + return candidate; + } + } + panic!("could not find zern std directory"); +} diff --git a/std/containers.zr b/std/containers.zr index bbafbba..ae5a308 100644 --- a/std/containers.zr +++ b/std/containers.zr @@ -1,4 +1,4 @@ -include "std/mem.zr" +include "mem.zr" struct Array data: ptr diff --git a/std/io.zr b/std/io.zr index 6d07774..d231447 100644 --- a/std/io.zr +++ b/std/io.zr @@ -1,5 +1,5 @@ -include "std/str.zr" -include "std/os.zr" +include "str.zr" +include "os.zr" func panic[msg: str] : void io.printf("PANIC: %s\n", msg) @@ -7,6 +7,10 @@ func panic[msg: str] : void _builtin_syscall(SYS_kill, os.getpid(), SIGABRT) os.exit(1) +func assert[cond: bool, msg: str] : void + if !cond + panic(msg) + func io.printf[..] : void s := _var_arg(0) as ptr i := 1 @@ -133,7 +137,7 @@ func io.read_binary_file[path: str] : Blob, bool return buf, true -func io.write_file[path: str, content: str] : bool +func io.write_text_file[path: str, content: str] : bool return io.write_binary_file(path, content as ptr, content->len()) func io.write_binary_file[path: str, content: ptr, size: i64] : bool diff --git a/std/json.zr b/std/json.zr index 39e60d8..7f5e862 100644 --- a/std/json.zr +++ b/std/json.zr @@ -1,4 +1,4 @@ -include "std/containers.zr" +include "containers.zr" const json.OBJECT = 0 const json.ARRAY = 1 @@ -76,6 +76,9 @@ func json.Value.free[v: json.Value] : void (v as ptr)->free() +func json.val[x: any] : any + return (x as json.Value)->value + func json.parse[s: str] : json.Value i := 0 return json._parse_value(s, ^i) diff --git a/std/mem.zr b/std/mem.zr index d3850ef..866e357 100644 --- a/std/mem.zr +++ b/std/mem.zr @@ -1,5 +1,5 @@ -include "std/linux_syscalls.zr" -include "std/num.zr" +include "linux_syscalls.zr" +include "num.zr" const MEM_BLOCK_SIZE = 32 diff --git a/std/net.zr b/std/net.zr index 950476b..520f279 100644 --- a/std/net.zr +++ b/std/net.zr @@ -1,4 +1,4 @@ -include "std/os.zr" +include "os.zr" const AF_INET = 2 const SOCK_STREAM = 1 diff --git a/std/num.zr b/std/num.zr index 8bb25a9..2565aed 100644 --- a/std/num.zr +++ b/std/num.zr @@ -1,4 +1,4 @@ -include "std/io.zr" +include "io.zr" func i64.abs[n: i64] : i64 if n == -9223372036854775808 diff --git a/std/os.zr b/std/os.zr index fafdbbf..e5efdac 100644 --- a/std/os.zr +++ b/std/os.zr @@ -1,7 +1,7 @@ -include "std/posix.zr" -include "std/linux_syscalls.zr" -include "std/str.zr" -include "std/containers.zr" +include "posix.zr" +include "linux_syscalls.zr" +include "str.zr" +include "containers.zr" func os.exit[code: i64] : void _builtin_syscall(SYS_exit, code) diff --git a/std/str.zr b/std/str.zr index 9e9b306..4e81f71 100644 --- a/std/str.zr +++ b/std/str.zr @@ -1,5 +1,5 @@ -include "std/num.zr" -include "std/mem.zr" +include "num.zr" +include "mem.zr" func u8.is_whitespace[x: u8] : bool return x == ' ' || x == '\n' || x == '\t' || x == '\r' diff --git a/test.zr b/test.zr index d880935..8ced788 100644 --- a/test.zr +++ b/test.zr @@ -1,5 +1,5 @@ -include "std/io.zr" -include "std/os.zr" +include "$/io.zr" +include "$/os.zr" struct TestRunner build_blacklist: Array