diff --git a/.gitignore b/.gitignore index 0db1aa4..f01f275 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ /out* /TODO /musl-* -/vscode \ No newline at end of file +/vscode diff --git a/README.md b/README.md index 484001e..a2d13c4 100644 --- a/README.md +++ b/README.md @@ -47,4 +47,4 @@ func main[] : i64 ``` cargo install --git https://github.com/antpiasecki/zern zern -m -r hello.zr -``` \ No newline at end of file +``` diff --git a/examples/brainfuck.zr b/examples/brainfuck.zr index 49a366a..bd674d5 100644 --- a/examples/brainfuck.zr +++ b/examples/brainfuck.zr @@ -46,4 +46,4 @@ func main[] : i64 i = i + 1 - mem.free(memory) \ No newline at end of file + mem.free(memory) diff --git a/examples/crypto.zr b/examples/crypto.zr index 76434db..0d8d6d9 100644 --- a/examples/crypto.zr +++ b/examples/crypto.zr @@ -56,4 +56,4 @@ func main[] : i64 let bob_shared: ptr = crypto.x25519.scalarmult(bob_private, alice_public) io.print("B_shared: ") - io.println(str.hex_encode(bob_shared, 32)) \ No newline at end of file + io.println(str.hex_encode(bob_shared, 32)) diff --git a/examples/curl.zr b/examples/curl.zr index 5f970b1..f0e44b9 100644 --- a/examples/curl.zr +++ b/examples/curl.zr @@ -67,4 +67,4 @@ func main[argc: i64, argv: ptr] : i64 io.print_sized(buffer, n) mem.free(buffer) - net.close(s) \ No newline at end of file + net.close(s) diff --git a/examples/fib.zr b/examples/fib.zr index 1bc9c60..00c2a15 100644 --- a/examples/fib.zr +++ b/examples/fib.zr @@ -6,4 +6,4 @@ func main[] : i64 io.println_i64(a) let temp: i64 = b b = a + b - a = temp \ No newline at end of file + a = temp diff --git a/examples/fizzbuzz.zr b/examples/fizzbuzz.zr index bf989f6..2c8dfd3 100644 --- a/examples/fizzbuzz.zr +++ b/examples/fizzbuzz.zr @@ -7,4 +7,4 @@ func main[] : i64 else if i % 3 == 0 io.println("Fizz") else - io.println_i64(i) \ No newline at end of file + io.println_i64(i) diff --git a/examples/functional.zr b/examples/functional.zr index ee90c42..c87fde1 100644 --- a/examples/functional.zr +++ b/examples/functional.zr @@ -8,4 +8,4 @@ func main[] : i64 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] |> alg.map(^square) |> alg.reduce(^sum, 0) - |> io.println_i64() \ No newline at end of file + |> io.println_i64() diff --git a/examples/guess_number.zr b/examples/guess_number.zr index 54db061..2be35f8 100644 --- a/examples/guess_number.zr +++ b/examples/guess_number.zr @@ -11,4 +11,4 @@ func main[] : i64 else if guess < answer io.println("Too low!") else - io.println("Too high!") \ No newline at end of file + io.println("Too high!") diff --git a/examples/hello.zr b/examples/hello.zr index b6e75b5..e8a8c1f 100644 --- a/examples/hello.zr +++ b/examples/hello.zr @@ -1,2 +1,2 @@ func main[] : i64 - io.println("Hello, World!") \ No newline at end of file + io.println("Hello, World!") diff --git a/examples/puzzles/aoc2024_01.zr b/examples/puzzles/aoc2024_01.zr index e4e7363..c827fba 100644 --- a/examples/puzzles/aoc2024_01.zr +++ b/examples/puzzles/aoc2024_01.zr @@ -32,4 +32,4 @@ func main[] : i64 alg.quicksort(l2) part1(l1, l2) - part2(l1, l2) \ No newline at end of file + part2(l1, l2) diff --git a/examples/puzzles/aoc2024_02.zr b/examples/puzzles/aoc2024_02.zr index 07d3002..9c87539 100644 --- a/examples/puzzles/aoc2024_02.zr +++ b/examples/puzzles/aoc2024_02.zr @@ -51,4 +51,4 @@ func main[] : i64 array.push(data, report) part1(data) - part2(data) \ No newline at end of file + part2(data) diff --git a/examples/puzzles/aoc2024_04.zr b/examples/puzzles/aoc2024_04.zr index c54a9fc..d5ea572 100644 --- a/examples/puzzles/aoc2024_04.zr +++ b/examples/puzzles/aoc2024_04.zr @@ -59,4 +59,4 @@ func main[] : i64 let lines: array = io.read_file("input.txt") |> str.split("\n") part1(lines) - part2(lines) \ No newline at end of file + part2(lines) diff --git a/examples/puzzles/aoc2024_05.zr b/examples/puzzles/aoc2024_05.zr index de9ab56..4a8ba78 100644 --- a/examples/puzzles/aoc2024_05.zr +++ b/examples/puzzles/aoc2024_05.zr @@ -70,4 +70,4 @@ func main[] : i64 array.push(updates, xs) part1(updates, rules_left, rules_right) - part2(updates, rules_left, rules_right) \ No newline at end of file + part2(updates, rules_left, rules_right) diff --git a/examples/puzzles/aoc2024_07.zr b/examples/puzzles/aoc2024_07.zr index 57c2e43..aca4486 100644 --- a/examples/puzzles/aoc2024_07.zr +++ b/examples/puzzles/aoc2024_07.zr @@ -74,4 +74,4 @@ func main[] : i64 array.push(equations, [str.parse_i64(array.nth(parts, 0)), xs]) part1(equations) - part2(equations) \ No newline at end of file + part2(equations) diff --git a/examples/puzzles/aoc2025_01.zr b/examples/puzzles/aoc2025_01.zr index 700d07c..4e130c5 100644 --- a/examples/puzzles/aoc2025_01.zr +++ b/examples/puzzles/aoc2025_01.zr @@ -50,4 +50,4 @@ func main[] : i64 let lines: array = io.read_file("input.txt") |> str.split("\n") part1(lines) - part2(lines) \ No newline at end of file + part2(lines) diff --git a/examples/puzzles/aoc2025_02.zr b/examples/puzzles/aoc2025_02.zr index 5f4fd4d..025bede 100644 --- a/examples/puzzles/aoc2025_02.zr +++ b/examples/puzzles/aoc2025_02.zr @@ -57,4 +57,4 @@ func main[] : i64 let ranges: array = io.read_file("input.txt") |> str.split(",") part1(ranges) - part2(ranges) \ No newline at end of file + part2(ranges) diff --git a/examples/puzzles/aoc2025_03.zr b/examples/puzzles/aoc2025_03.zr index 7c5d1a9..0feb07d 100644 --- a/examples/puzzles/aoc2025_03.zr +++ b/examples/puzzles/aoc2025_03.zr @@ -48,4 +48,4 @@ func main[] : i64 let lines: array = io.read_file("input.txt") |> str.split("\n") part1(lines) - part2(lines) \ No newline at end of file + part2(lines) diff --git a/examples/puzzles/euler_00.zr b/examples/puzzles/euler_00.zr index 138412f..f8c8ae8 100644 --- a/examples/puzzles/euler_00.zr +++ b/examples/puzzles/euler_00.zr @@ -5,4 +5,4 @@ func main[] : i64 if i % 2 != 0 sum = sum + i * i - io.println_i64(sum) \ No newline at end of file + io.println_i64(sum) diff --git a/examples/puzzles/euler_01.zr b/examples/puzzles/euler_01.zr index c279f38..4d3a314 100644 --- a/examples/puzzles/euler_01.zr +++ b/examples/puzzles/euler_01.zr @@ -4,4 +4,4 @@ func main[] : i64 for i in 0..1000 if i % 5 == 0 || i % 3 == 0 sum = sum + i - io.println_i64(sum) \ No newline at end of file + io.println_i64(sum) diff --git a/examples/puzzles/euler_02.zr b/examples/puzzles/euler_02.zr index 4078c53..87e939d 100644 --- a/examples/puzzles/euler_02.zr +++ b/examples/puzzles/euler_02.zr @@ -10,4 +10,4 @@ func main[] : i64 b = a + b a = temp - io.println_i64(sum) \ No newline at end of file + io.println_i64(sum) diff --git a/examples/puzzles/euler_03.zr b/examples/puzzles/euler_03.zr index 72928ba..0f47b6e 100644 --- a/examples/puzzles/euler_03.zr +++ b/examples/puzzles/euler_03.zr @@ -8,4 +8,4 @@ func main[] : i64 else f = f + 1 - io.println_i64(n) \ No newline at end of file + io.println_i64(n) diff --git a/examples/puzzles/euler_04.zr b/examples/puzzles/euler_04.zr index 866cee1..315c962 100644 --- a/examples/puzzles/euler_04.zr +++ b/examples/puzzles/euler_04.zr @@ -10,4 +10,4 @@ func main[] : i64 out = a * b mem.free(s) mem.free(s_rev) - io.println_i64(out) \ No newline at end of file + io.println_i64(out) diff --git a/examples/puzzles/euler_05.zr b/examples/puzzles/euler_05.zr index b911e6e..c5721c2 100644 --- a/examples/puzzles/euler_05.zr +++ b/examples/puzzles/euler_05.zr @@ -3,4 +3,4 @@ func main[] : i64 for i in 1..21 out = math.lcm(out, i) - io.println_i64(out) \ No newline at end of file + io.println_i64(out) diff --git a/examples/puzzles/euler_06.zr b/examples/puzzles/euler_06.zr index d2c1733..321bbaa 100644 --- a/examples/puzzles/euler_06.zr +++ b/examples/puzzles/euler_06.zr @@ -8,4 +8,4 @@ func main[] : i64 square_of_sum = square_of_sum + i square_of_sum = square_of_sum * square_of_sum - io.println_i64(square_of_sum - sum_of_squares) \ No newline at end of file + io.println_i64(square_of_sum - sum_of_squares) diff --git a/examples/puzzles/euler_07.zr b/examples/puzzles/euler_07.zr index b9fdfac..9d57f0b 100644 --- a/examples/puzzles/euler_07.zr +++ b/examples/puzzles/euler_07.zr @@ -8,4 +8,4 @@ func main[] : i64 if found == 10001 io.println_i64(i) break - i = i + 1 \ No newline at end of file + i = i + 1 diff --git a/examples/puzzles/euler_08.zr b/examples/puzzles/euler_08.zr index 0fd5bc5..5eb3d0f 100644 --- a/examples/puzzles/euler_08.zr +++ b/examples/puzzles/euler_08.zr @@ -11,4 +11,4 @@ func main[] : i64 j = j + 1 if s > out out = s - io.println_i64(out) \ No newline at end of file + io.println_i64(out) diff --git a/examples/puzzles/euler_09.zr b/examples/puzzles/euler_09.zr index 0aaa26b..58465b3 100644 --- a/examples/puzzles/euler_09.zr +++ b/examples/puzzles/euler_09.zr @@ -4,4 +4,4 @@ func main[] : i64 let c: i64 = 1000 - b - a if a * a + b * b == c * c io.println_i64(a * b * c) - return 0 \ No newline at end of file + return 0 diff --git a/examples/puzzles/euler_10.zr b/examples/puzzles/euler_10.zr index bcda753..6201f1f 100644 --- a/examples/puzzles/euler_10.zr +++ b/examples/puzzles/euler_10.zr @@ -4,4 +4,4 @@ func main[] : i64 for i in 0..2000000 if math.is_prime(i) sum = sum + i - io.println_i64(sum) \ No newline at end of file + io.println_i64(sum) diff --git a/examples/puzzles/euler_11.zr b/examples/puzzles/euler_11.zr index 9b6da28..8e1d8fa 100644 --- a/examples/puzzles/euler_11.zr +++ b/examples/puzzles/euler_11.zr @@ -33,4 +33,4 @@ func main[] : i64 let d2: i64 = array.nth(array.nth(grid, i), N-j-1) * array.nth(array.nth(grid, i+1), N-j-2) * array.nth(array.nth(grid, i+2), N-j-3) * array.nth(array.nth(grid, i+3), N-j-4) out = math.max(out, math.max(h, math.max(v, math.max(d1, d2)))) - io.println_i64(out) \ No newline at end of file + io.println_i64(out) diff --git a/examples/puzzles/euler_12.zr b/examples/puzzles/euler_12.zr index 2ba0bc0..ba3dc86 100644 --- a/examples/puzzles/euler_12.zr +++ b/examples/puzzles/euler_12.zr @@ -18,4 +18,4 @@ func main[] : i64 if num_divisors(n) > 500 io.println_i64(n) break - i = i + 1 \ No newline at end of file + i = i + 1 diff --git a/examples/puzzles/euler_13.zr b/examples/puzzles/euler_13.zr index e1b3084..98b96ea 100644 --- a/examples/puzzles/euler_13.zr +++ b/examples/puzzles/euler_13.zr @@ -3,4 +3,4 @@ func main[] : i64 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 |> str.from_i64() |> str.substr(0, 10) - |> io.println() \ No newline at end of file + |> io.println() diff --git a/examples/puzzles/euler_14.zr b/examples/puzzles/euler_14.zr index 82fa9df..db3434e 100644 --- a/examples/puzzles/euler_14.zr +++ b/examples/puzzles/euler_14.zr @@ -19,4 +19,4 @@ func main[] : i64 if seq > max max = seq max_index = i - io.println_i64(max_index) \ No newline at end of file + io.println_i64(max_index) diff --git a/examples/puzzles/euler_15.zr b/examples/puzzles/euler_15.zr index 40a0b40..69695db 100644 --- a/examples/puzzles/euler_15.zr +++ b/examples/puzzles/euler_15.zr @@ -6,4 +6,4 @@ func main[] : i64 for i in 1..r+1 out = out * (n - (r - i)) / i - io.println_i64(out) \ No newline at end of file + io.println_i64(out) diff --git a/examples/puzzles/euler_17.zr b/examples/puzzles/euler_17.zr index 5d9b0ad..55f8d10 100644 --- a/examples/puzzles/euler_17.zr +++ b/examples/puzzles/euler_17.zr @@ -23,4 +23,4 @@ func main[] : i64 sum = sum + array.nth(s1, 1) + 8 - io.println_i64(sum) \ No newline at end of file + io.println_i64(sum) diff --git a/examples/puzzles/euler_19.zr b/examples/puzzles/euler_19.zr index 9def4b9..13c8596 100644 --- a/examples/puzzles/euler_19.zr +++ b/examples/puzzles/euler_19.zr @@ -19,4 +19,4 @@ func main[] : i64 sun = sun + 1 wday = (wday + days(year, mon)) % 7 - io.println_i64(sun) \ No newline at end of file + io.println_i64(sun) diff --git a/examples/puzzles/euler_20.zr b/examples/puzzles/euler_20.zr index 116648a..2e22edf 100644 --- a/examples/puzzles/euler_20.zr +++ b/examples/puzzles/euler_20.zr @@ -18,4 +18,4 @@ func main[] : i64 for i in 0..array.size(n) sum = sum + array.nth(n, i) - io.println_i64(sum) \ No newline at end of file + io.println_i64(sum) diff --git a/examples/puzzles/euler_21.zr b/examples/puzzles/euler_21.zr index c8be475..5810bad 100644 --- a/examples/puzzles/euler_21.zr +++ b/examples/puzzles/euler_21.zr @@ -18,4 +18,4 @@ func main[] : i64 if i < d && i == divisors_sum(d) sum = sum + i + d - io.println_i64(sum) \ No newline at end of file + io.println_i64(sum) diff --git a/examples/quicksort.zr b/examples/quicksort.zr index dca50f3..253f3be 100644 --- a/examples/quicksort.zr +++ b/examples/quicksort.zr @@ -12,4 +12,4 @@ func main[] : i64 for i in 0..array.size(arr) io.println_i64(array.nth(arr, i)) - array.free(arr) \ No newline at end of file + array.free(arr) diff --git a/examples/raylib.zr b/examples/raylib.zr index 13c3ed5..58de9ce 100644 --- a/examples/raylib.zr +++ b/examples/raylib.zr @@ -39,4 +39,4 @@ func main[] : i64 DrawRectangle(x, y, 100, 100, RED) EndDrawing() - CloseWindow() \ No newline at end of file + CloseWindow() diff --git a/examples/rule110.zr b/examples/rule110.zr index c66db77..a92eb13 100644 --- a/examples/rule110.zr +++ b/examples/rule110.zr @@ -36,4 +36,4 @@ func main[] : i64 state = rule110_step(state) print_state(state) - array.free(state) \ No newline at end of file + array.free(state) diff --git a/examples/tcp_server.zr b/examples/tcp_server.zr index 34419da..d6db5ec 100644 --- a/examples/tcp_server.zr +++ b/examples/tcp_server.zr @@ -10,4 +10,4 @@ func main[] : i64 let n: i64 = net.read(conn, resp, 60000) net.send(conn, resp, n) - net.close(conn) \ No newline at end of file + net.close(conn) diff --git a/src/std/crypto.zr b/src/std/crypto.zr index b9b1893..fdbd978 100644 --- a/src/std/crypto.zr +++ b/src/std/crypto.zr @@ -410,4 +410,4 @@ func crypto.x25519.scalarmult[scalar: ptr, point: ptr] : ptr mem.zero_and_free(f, 16 * 8) mem.zero_and_free(x, 16 * 8) mem.free(magic) - return out \ No newline at end of file + return out diff --git a/src/std/std.zr b/src/std/std.zr index 5857c89..07b78c8 100644 --- a/src/std/std.zr +++ b/src/std/std.zr @@ -669,4 +669,4 @@ func net.close[s: i64] : void _builtin_syscall(SYS_close, s) func net.pack_addr[a: i64, b: i64, c: i64, d: i64] : i64 - return (a << 24) | (b << 16) | (c << 8) | d \ No newline at end of file + return (a << 24) | (b << 16) | (c << 8) | d diff --git a/test.zr b/test.zr index 4e3b93a..b5770d9 100644 --- a/test.zr +++ b/test.zr @@ -60,4 +60,4 @@ func main[] : i64 os.shell("cargo build --release") run_directory("examples/") - run_directory("examples/puzzles/") \ No newline at end of file + run_directory("examples/puzzles/")