Skip to content

Commit be385f4

Browse files
committed
Zig says Hello!
Zig is intended to be a successor to C, but being even smaller with more functionality. It supports cross-compilation natively.
1 parent a9e2af6 commit be385f4

File tree

6 files changed

+33
-1
lines changed

6 files changed

+33
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<p align="center">
44
<a href="https://hub.docker.com/r/100hellos" alt="DockerHub!">
5-
<img src="https://img.shields.io/badge/Hello%20World!-42_to_go-yellow"
5+
<img src="https://img.shields.io/badge/Hello%20World!-41_to_go-yellow"
66
height="130"></a>
77
</p>
88

zig/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# syntax=docker/dockerfile:1
2+
# escape=\
3+
FROM 100hellos/000-base:local
4+
5+
RUN curl -o zig.tar.xz https://ziglang.org/builds/zig-linux-x86_64-0.14.0-dev.2063+5ce17ecfa.tar.xz && \
6+
mv zig.tar.xz /tmp/zig.tar.xz && \
7+
cd /tmp && \
8+
tar -xvf zig.tar.xz && \
9+
mv zig-linux-x86_64-0.14.0-dev.2063+5ce17ecfa /usr/local/zig
10+
11+
ENV PATH=/usr/local/zig:$PATH
12+
13+
COPY --chown=human:human ./files /hello-world

zig/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include ../Makefile.language-container.mk

zig/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Zig
2+
3+
Zig supports compile time code execution, which means you can run code at compile time to generate more code. This can be used for things like generating boilerplate code, or even for more complex tasks like parsing files or generating data structures. This can be a powerful tool for metaprogramming, and can help you write more concise and maintainable code.
4+
5+
This means you can add blocks to your code that execute at compile time with:
6+
7+
```zig
8+
comptime {
9+
// code that runs at compile time
10+
}
11+
```

zig/files/hello-world.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env sh
2+
3+
zig run hello-world.zig

zig/files/hello-world.zig

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const std = @import("std");
2+
pub fn main() !void {
3+
std.debug.print("Hello World!\n", .{});
4+
}

0 commit comments

Comments
 (0)