add zig as a language
This commit is contained in:
parent
b98722582b
commit
d69c3ceb73
4
.editorconfig
Normal file
4
.editorconfig
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*.zig]
|
||||||
|
indent_style = space
|
6
Day01/Part1.zig
Normal file
6
Day01/Part1.zig
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
pub fn main() !void {
|
||||||
|
const stdout = std.io.getStdOut().writer();
|
||||||
|
try stdout.print("Hello, {s}!\n", .{"world"});
|
||||||
|
}
|
3
clean
3
clean
@ -4,5 +4,4 @@ part="$2"
|
|||||||
|
|
||||||
day="$(printf '%02d' "$day")"
|
day="$(printf '%02d' "$day")"
|
||||||
|
|
||||||
rm -f ./run ./luac.out
|
rm -r -f run "Day${day}/Part${part}.hi" "Day${1}/Part${part}.o" "Day${day}/zig-cache"
|
||||||
rm -f "Day${1}/Part${2}.hi" "Day${1}/Part${2}.o"
|
|
||||||
|
12
prepare
12
prepare
@ -4,11 +4,15 @@ part="$2"
|
|||||||
|
|
||||||
day="$(printf '%02d' "$day")"
|
day="$(printf '%02d' "$day")"
|
||||||
|
|
||||||
if test -f "Day${day}/Part${part}.lua"; then
|
name="Day${day}/Part${part}"
|
||||||
luac -o luac.out "Day${day}/Part${part}.lua"
|
|
||||||
|
if zig -h > /dev/null && test -f "${name}.zig"; then
|
||||||
|
zig build-exe --name run "${name}.zig"
|
||||||
|
elif luac -v > /dev/null && test -f "${name}.lua"; then
|
||||||
|
luac -o luac.out "${name}.lua"
|
||||||
printf '#!/bin/sh\nlua luac.out "$@"\n' > run
|
printf '#!/bin/sh\nlua luac.out "$@"\n' > run
|
||||||
chmod u+x run
|
chmod u+x run
|
||||||
elif test -f "Day${day}/Part${part}.hs"; then
|
elif stack > /dev/null && test -f "${name}.hs"; then
|
||||||
#stack build
|
#stack build
|
||||||
stack ghc -- -O3 "Day${day}/Part${part}.hs" -o run
|
stack ghc -- -O3 "${name}.hs" -o run
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user