From 53d41b31e714765d356f2130b694dd1739d85ffd Mon Sep 17 00:00:00 2001 From: Luna Date: Wed, 18 Sep 2019 11:37:08 -0300 Subject: [PATCH] add examples/hello.ry --- examples/hello.ry | 11 +++++++++++ src/main.zig | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 examples/hello.ry diff --git a/examples/hello.ry b/examples/hello.ry new file mode 100644 index 0000000..1bf8dba --- /dev/null +++ b/examples/hello.ry @@ -0,0 +1,11 @@ +import std; + +fn add(a: i32, b: i32) i32 { + return a + b; +} + +// type is void by default +fn main() { + std.fmt.print("piss\n"); + // std.fmt.print("2 + 2 = %d\n", add(1, 2)); +} diff --git a/src/main.zig b/src/main.zig index 128820d..5a8e280 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,5 +1,9 @@ const std = @import("std"); pub fn main() anyerror!void { - std.debug.warn("All your base are belong to us.\n"); + const allocator = std.heap.direct_allocator; + var args_it = std.process.args(); + _ = args_it.skip(); + + const filepath = try (args_it.next(allocator) orelse @panic("expected file path")); }