Add a ZIG test program.

The zig compiler is way behing on opensuse.
I tried building zig from source but encountered many compile errors.

I'll wait until opensuse is updated.
This commit is contained in:
Ernie Pasveer
2024-10-12 10:54:33 -05:00
parent ddec770cd3
commit 3a0aecd81e
6 changed files with 79 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
hello-zig
assignment
integers
+16
View File
@@ -0,0 +1,16 @@
.PHONY: all
all: hello-world assignment integers
hello-world: hello-world.zig
zig build-exe -O Debug hello-world.zig
assignment: assignment.zig
zig build-exe -O Debug assignment.zig
integers: integers.zig
zig build-exe -O Debug integers.zig
.PHONY: clean
clean:
rm -f *.o hello-world assignment integers
+18
View File
@@ -0,0 +1,18 @@
Examples are from here:
https://zig-by-example.com/
Run Seer like this. The break-function is the name of the program and ".main".
$ /usr/local/bin/seergdb -s --bf=hello-world.main ./hello-world
Set the "Source" file configurations in Seer's config page.
o Add "*.zig" for valid source files.
o Add "/usr/lib/zig/" for "misc" files.
Zig resources:
https://github.com/ziglang/zig
https://github.com/zigcc/awesome-zig
+17
View File
@@ -0,0 +1,17 @@
const std = @import("std");
pub fn main() !void {
const c: bool = true;
var v: bool = false;
v = true;
const inferred = true;
var u: bool = undefined;
u = true;
_ = c;
_ = inferred;
}
+5
View File
@@ -0,0 +1,5 @@
const std = @import("std");
pub fn main() !void {
std.debug.print("Hello, World!\n", .{});
}
+19
View File
@@ -0,0 +1,19 @@
const std = @import("std");
const print = std.debug.print;
const a: u8 = 1;
const b: u32 = 10;
const c: i64 = 100;
const d: isize = 1_000;
const e: u21 = 10_000;
const f: i42 = 100_000;
const g: comptime_int = 1_000_000;
const h = 10_000_000;
const i = '💯';
pub fn main() !void {
print("integer: {d}\n", .{i});
print("unicode: {u}\n", .{i});
}