From fc6f337c694425d1183f82b21c5cfd680badbe8d Mon Sep 17 00:00:00 2001 From: bacon <13384390+bacn@users.noreply.github.com> Date: Sat, 2 Nov 2024 09:58:13 +0800 Subject: [PATCH] feat: add nim --- docs/README.txt | 1 + entry/nim.sh | 1 + routes/run.go | 1 + scripts/images.sh | 1 + scripts/tests.sh | 1 + 5 files changed, 5 insertions(+) create mode 100644 entry/nim.sh diff --git a/docs/README.txt b/docs/README.txt index 8727cf1..554248d 100644 --- a/docs/README.txt +++ b/docs/README.txt @@ -28,6 +28,7 @@ Supported languages: Clojure 18 x86 Assembly 19 Zig 20 + Nim 21 Please set this up on a SELinux-enabled system. diff --git a/entry/nim.sh b/entry/nim.sh new file mode 100644 index 0000000..d13cfd0 --- /dev/null +++ b/entry/nim.sh @@ -0,0 +1 @@ +nim compile --nimcache:/tmp --usenimcache -w:off --hints:off --passC:"-w" --run source.nim diff --git a/routes/run.go b/routes/run.go index 95d4f54..f43d988 100644 --- a/routes/run.go +++ b/routes/run.go @@ -66,6 +66,7 @@ func getLanguageConfig() map[string]map[string]string { "18": {"entry": "clojure", "ext": "clj", "image": "whipcode-clojure"}, "19": {"entry": "nasm", "ext": "asm", "image": "whipcode-nasm"}, "20": {"entry": "zig", "ext": "zig", "image": "whipcode-zig"}, + "21": {"entry": "nim", "ext": "nim", "image": "whipcode-nim"}, } } diff --git a/scripts/images.sh b/scripts/images.sh index ae65b46..b353af3 100644 --- a/scripts/images.sh +++ b/scripts/images.sh @@ -49,6 +49,7 @@ declare -A langs=( [clojure]='clojure' [nasm]='nasm binutils' [zig]='zig' + [nim]='nim gcc' ) HEADER="FROM docker.io/alpine:latest" diff --git a/scripts/tests.sh b/scripts/tests.sh index 1bab9c5..f7bff01 100644 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -39,6 +39,7 @@ declare -A langs=( [18]='(println "Success!")' [19]='section .text \nglobal _start \n_start:\n mov edx, len \n mov ecx, msg \n mov ebx, 1\n mov eax, 4\n int 0x80\n mov eax, 1\n int 0x80\nsection .data \n msg db "Success!", 0xa\n len equ $ -msg\n' [20]='const std = @import("std");pub fn main() !void { std.io.getStdOut().writeAll("Success!") catch unreachable; }' + [21]='echo "Success!"' ) for i in "${!langs[@]}"; do