add zig as a language

This commit is contained in:
Felix Van der Jeugt 2021-12-02 10:25:13 +01:00
parent b98722582b
commit d69c3ceb73
No known key found for this signature in database
GPG key ID: 58B209295023754D
4 changed files with 19 additions and 6 deletions

12
prepare
View file

@ -4,11 +4,15 @@ part="$2"
day="$(printf '%02d' "$day")"
if test -f "Day${day}/Part${part}.lua"; then
luac -o luac.out "Day${day}/Part${part}.lua"
name="Day${day}/Part${part}"
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
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 ghc -- -O3 "Day${day}/Part${part}.hs" -o run
stack ghc -- -O3 "${name}.hs" -o run
fi