mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 08:34:42 +08:00
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:
@@ -0,0 +1,4 @@
|
||||
hello-zig
|
||||
assignment
|
||||
integers
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn main() !void {
|
||||
std.debug.print("Hello, World!\n", .{});
|
||||
}
|
||||
@@ -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});
|
||||
}
|
||||
Reference in New Issue
Block a user