From e24a2fa37684deca503449717cb72992d98b01d6 Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Sat, 18 Apr 2026 18:39:55 +0200 Subject: [PATCH 01/10] awk: the -O option is enabled by default --- impls/awk/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impls/awk/run b/impls/awk/run index 9c3061869f..035bed1e3f 100755 --- a/impls/awk/run +++ b/impls/awk/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec awk -O -f $(dirname $0)/${STEP:-stepA_mal}.awk "${@}" +exec awk -f $(dirname $0)/${STEP:-stepA_mal}.awk "${@}" From 7b8fe27526e5382522bc4535cbd83b3d12688268 Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Sat, 18 Apr 2026 18:41:55 +0200 Subject: [PATCH 02/10] vhdl: clean vhdl_argv.tmp in Makefile instead of run --- impls/vhdl/Makefile | 2 +- impls/vhdl/run_vhdl.sh | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/impls/vhdl/Makefile b/impls/vhdl/Makefile index e76b8e104a..5e9fe86a7d 100644 --- a/impls/vhdl/Makefile +++ b/impls/vhdl/Makefile @@ -32,4 +32,4 @@ $(BINS): %: %.o if [ "$@" = "stepA_mal" ]; then mv stepa_mal $@; fi clean: - rm -f $(OBJS) $(BINS) $(OTHER_OBJS) work-obj93.cf mal + rm -f $(OBJS) $(BINS) $(OTHER_OBJS) work-obj93.cf mal vhdl_argv.tmp diff --git a/impls/vhdl/run_vhdl.sh b/impls/vhdl/run_vhdl.sh index 1cc8e3bf9f..14fbd35131 100755 --- a/impls/vhdl/run_vhdl.sh +++ b/impls/vhdl/run_vhdl.sh @@ -5,12 +5,6 @@ # vhdl_argv.tmp, and read the content of that file at the beginning of the VHDL # program. -cleanup() { - trap - TERM QUIT INT EXIT - rm -f vhdl_argv.tmp -} -trap "cleanup" TERM QUIT INT EXIT - bin="$1" shift From 7c9f49c74535ced65bf31844d5974ed7da780651 Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Sat, 18 Apr 2026 18:57:02 +0200 Subject: [PATCH 03/10] Remove unnecessary shebangs or execution rights Shebangs are convenient, but not portable, and they increase the complexity. Most were ignored for the more general "run" script. --- examples/clojurewest2014.mal | 0 examples/presentation.mal | 0 impls/ada/Dockerfile | 0 impls/bash/step0_repl.sh | 2 -- impls/bash/step1_read_print.sh | 2 -- impls/bash/step2_eval.sh | 2 -- impls/bash/step3_env.sh | 2 -- impls/bash/step4_if_fn_do.sh | 2 -- impls/bash/step5_tco.sh | 2 -- impls/bash/step6_file.sh | 2 -- impls/bash/step7_quote.sh | 2 -- impls/bash/step8_macros.sh | 2 -- impls/bash/step9_try.sh | 2 -- impls/bash/stepA_mal.sh | 2 -- impls/basic/step0_repl.in.bas | 0 impls/basic/step1_read_print.in.bas | 0 impls/basic/step2_eval.in.bas | 0 impls/basic/step3_env.in.bas | 0 impls/basic/step4_if_fn_do.in.bas | 0 impls/basic/step5_tco.in.bas | 0 impls/basic/step6_file.in.bas | 0 impls/basic/step7_quote.in.bas | 0 impls/basic/step8_macros.in.bas | 0 impls/basic/step9_try.in.bas | 0 impls/basic/stepA_mal.in.bas | 0 impls/crystal/step0_repl.cr | 2 -- impls/crystal/step1_read_print.cr | 2 -- impls/crystal/step2_eval.cr | 2 -- impls/crystal/step3_env.cr | 2 -- impls/crystal/step4_if_fn_do.cr | 2 -- impls/crystal/step5_tco.cr | 2 -- impls/crystal/step6_file.cr | 2 -- impls/crystal/step7_quote.cr | 2 -- impls/crystal/step8_macros.cr | 2 -- impls/crystal/step9_try.cr | 2 -- impls/crystal/stepA_mal.cr | 2 -- impls/factor/step0_repl/step0_repl.factor | 0 impls/factor/step1_read_print/step1_read_print.factor | 0 impls/factor/step2_eval/step2_eval.factor | 0 impls/factor/step3_env/step3_env.factor | 0 impls/factor/step4_if_fn_do/step4_if_fn_do.factor | 0 impls/factor/step5_tco/step5_tco.factor | 0 impls/factor/step6_file/step6_file.factor | 0 impls/factor/step7_quote/step7_quote.factor | 0 impls/factor/step8_macros/step8_macros.factor | 0 impls/factor/step9_try/step9_try.factor | 0 impls/factor/stepA_mal/stepA_mal.factor | 0 impls/hy/run | 2 +- impls/hy/step0_repl.hy | 2 -- impls/hy/step1_read_print.hy | 2 -- impls/hy/step2_eval.hy | 2 -- impls/hy/step3_env.hy | 2 -- impls/hy/step4_if_fn_do.hy | 2 -- impls/hy/step5_tco.hy | 2 -- impls/hy/step6_file.hy | 2 -- impls/hy/step7_quote.hy | 2 -- impls/hy/step8_macros.hy | 2 -- impls/hy/step9_try.hy | 2 -- impls/hy/stepA_mal.hy | 2 -- impls/julia/step0_repl.jl | 2 -- impls/julia/step1_read_print.jl | 2 -- impls/julia/step2_eval.jl | 2 -- impls/julia/step3_env.jl | 2 -- impls/julia/step4_if_fn_do.jl | 2 -- impls/julia/step5_tco.jl | 2 -- impls/julia/step6_file.jl | 2 -- impls/julia/step7_quote.jl | 2 -- impls/julia/step8_macros.jl | 2 -- impls/julia/step9_try.jl | 2 -- impls/julia/stepA_mal.jl | 2 -- impls/lua/step0_repl.lua | 2 -- impls/lua/step1_read_print.lua | 2 -- impls/lua/step2_eval.lua | 2 -- impls/lua/step3_env.lua | 2 -- impls/lua/step4_if_fn_do.lua | 2 -- impls/lua/step5_tco.lua | 2 -- impls/lua/step6_file.lua | 2 -- impls/lua/step7_quote.lua | 2 -- impls/lua/step8_macros.lua | 2 -- impls/lua/step9_try.lua | 2 -- impls/lua/stepA_mal.lua | 2 -- impls/make/reader.mk | 0 impls/perl/step0_repl.pl | 2 -- impls/perl/step1_read_print.pl | 2 -- impls/perl/step2_eval.pl | 2 -- impls/perl/step3_env.pl | 2 -- impls/perl/step4_if_fn_do.pl | 2 -- impls/perl/step5_tco.pl | 2 -- impls/perl/step6_file.pl | 2 -- impls/perl/step7_quote.pl | 2 -- impls/perl/step8_macros.pl | 2 -- impls/perl/step9_try.pl | 2 -- impls/perl/stepA_mal.pl | 2 -- impls/plpgsql/init.sql | 0 impls/racket/step0_repl.rkt | 1 - impls/racket/step1_read_print.rkt | 1 - impls/racket/step2_eval.rkt | 1 - impls/racket/step3_env.rkt | 1 - impls/racket/step4_if_fn_do.rkt | 1 - impls/racket/step5_tco.rkt | 1 - impls/racket/step6_file.rkt | 1 - impls/racket/step7_quote.rkt | 1 - impls/racket/step8_macros.rkt | 1 - impls/racket/step9_try.rkt | 1 - impls/racket/stepA_mal.rkt | 1 - impls/wasm/run | 2 +- impls/wasm/run.js | 4 +--- 107 files changed, 3 insertions(+), 148 deletions(-) mode change 100755 => 100644 examples/clojurewest2014.mal mode change 100755 => 100644 examples/presentation.mal mode change 100755 => 100644 impls/ada/Dockerfile mode change 100755 => 100644 impls/bash/step0_repl.sh mode change 100755 => 100644 impls/bash/step1_read_print.sh mode change 100755 => 100644 impls/bash/step2_eval.sh mode change 100755 => 100644 impls/bash/step3_env.sh mode change 100755 => 100644 impls/bash/step4_if_fn_do.sh mode change 100755 => 100644 impls/bash/step5_tco.sh mode change 100755 => 100644 impls/bash/step6_file.sh mode change 100755 => 100644 impls/bash/step7_quote.sh mode change 100755 => 100644 impls/bash/step8_macros.sh mode change 100755 => 100644 impls/bash/step9_try.sh mode change 100755 => 100644 impls/bash/stepA_mal.sh mode change 100755 => 100644 impls/basic/step0_repl.in.bas mode change 100755 => 100644 impls/basic/step1_read_print.in.bas mode change 100755 => 100644 impls/basic/step2_eval.in.bas mode change 100755 => 100644 impls/basic/step3_env.in.bas mode change 100755 => 100644 impls/basic/step4_if_fn_do.in.bas mode change 100755 => 100644 impls/basic/step5_tco.in.bas mode change 100755 => 100644 impls/basic/step6_file.in.bas mode change 100755 => 100644 impls/basic/step7_quote.in.bas mode change 100755 => 100644 impls/basic/step8_macros.in.bas mode change 100755 => 100644 impls/basic/step9_try.in.bas mode change 100755 => 100644 impls/basic/stepA_mal.in.bas mode change 100755 => 100644 impls/crystal/step0_repl.cr mode change 100755 => 100644 impls/crystal/step1_read_print.cr mode change 100755 => 100644 impls/crystal/step2_eval.cr mode change 100755 => 100644 impls/crystal/step3_env.cr mode change 100755 => 100644 impls/crystal/step4_if_fn_do.cr mode change 100755 => 100644 impls/crystal/step5_tco.cr mode change 100755 => 100644 impls/crystal/step6_file.cr mode change 100755 => 100644 impls/crystal/step7_quote.cr mode change 100755 => 100644 impls/crystal/step8_macros.cr mode change 100755 => 100644 impls/crystal/step9_try.cr mode change 100755 => 100644 impls/crystal/stepA_mal.cr mode change 100755 => 100644 impls/factor/step0_repl/step0_repl.factor mode change 100755 => 100644 impls/factor/step1_read_print/step1_read_print.factor mode change 100755 => 100644 impls/factor/step2_eval/step2_eval.factor mode change 100755 => 100644 impls/factor/step3_env/step3_env.factor mode change 100755 => 100644 impls/factor/step4_if_fn_do/step4_if_fn_do.factor mode change 100755 => 100644 impls/factor/step5_tco/step5_tco.factor mode change 100755 => 100644 impls/factor/step6_file/step6_file.factor mode change 100755 => 100644 impls/factor/step7_quote/step7_quote.factor mode change 100755 => 100644 impls/factor/step8_macros/step8_macros.factor mode change 100755 => 100644 impls/factor/step9_try/step9_try.factor mode change 100755 => 100644 impls/factor/stepA_mal/stepA_mal.factor mode change 100755 => 100644 impls/hy/step0_repl.hy mode change 100755 => 100644 impls/hy/step1_read_print.hy mode change 100755 => 100644 impls/hy/step2_eval.hy mode change 100755 => 100644 impls/hy/step3_env.hy mode change 100755 => 100644 impls/hy/step4_if_fn_do.hy mode change 100755 => 100644 impls/hy/step5_tco.hy mode change 100755 => 100644 impls/hy/step6_file.hy mode change 100755 => 100644 impls/hy/step7_quote.hy mode change 100755 => 100644 impls/hy/step8_macros.hy mode change 100755 => 100644 impls/hy/step9_try.hy mode change 100755 => 100644 impls/hy/stepA_mal.hy mode change 100755 => 100644 impls/julia/step0_repl.jl mode change 100755 => 100644 impls/julia/step1_read_print.jl mode change 100755 => 100644 impls/julia/step2_eval.jl mode change 100755 => 100644 impls/julia/step3_env.jl mode change 100755 => 100644 impls/julia/step4_if_fn_do.jl mode change 100755 => 100644 impls/julia/step5_tco.jl mode change 100755 => 100644 impls/julia/step6_file.jl mode change 100755 => 100644 impls/julia/step7_quote.jl mode change 100755 => 100644 impls/julia/step8_macros.jl mode change 100755 => 100644 impls/julia/step9_try.jl mode change 100755 => 100644 impls/julia/stepA_mal.jl mode change 100755 => 100644 impls/lua/step0_repl.lua mode change 100755 => 100644 impls/lua/step1_read_print.lua mode change 100755 => 100644 impls/lua/step2_eval.lua mode change 100755 => 100644 impls/lua/step3_env.lua mode change 100755 => 100644 impls/lua/step4_if_fn_do.lua mode change 100755 => 100644 impls/lua/step5_tco.lua mode change 100755 => 100644 impls/lua/step6_file.lua mode change 100755 => 100644 impls/lua/step7_quote.lua mode change 100755 => 100644 impls/lua/step8_macros.lua mode change 100755 => 100644 impls/lua/step9_try.lua mode change 100755 => 100644 impls/lua/stepA_mal.lua mode change 100755 => 100644 impls/make/reader.mk mode change 100755 => 100644 impls/plpgsql/init.sql mode change 100755 => 100644 impls/racket/step0_repl.rkt mode change 100755 => 100644 impls/racket/step1_read_print.rkt mode change 100755 => 100644 impls/racket/step2_eval.rkt mode change 100755 => 100644 impls/racket/step3_env.rkt mode change 100755 => 100644 impls/racket/step4_if_fn_do.rkt mode change 100755 => 100644 impls/racket/step5_tco.rkt mode change 100755 => 100644 impls/racket/step6_file.rkt mode change 100755 => 100644 impls/racket/step7_quote.rkt mode change 100755 => 100644 impls/racket/step8_macros.rkt mode change 100755 => 100644 impls/racket/step9_try.rkt mode change 100755 => 100644 impls/racket/stepA_mal.rkt mode change 100755 => 100644 impls/wasm/run.js diff --git a/examples/clojurewest2014.mal b/examples/clojurewest2014.mal old mode 100755 new mode 100644 diff --git a/examples/presentation.mal b/examples/presentation.mal old mode 100755 new mode 100644 diff --git a/impls/ada/Dockerfile b/impls/ada/Dockerfile old mode 100755 new mode 100644 diff --git a/impls/bash/step0_repl.sh b/impls/bash/step0_repl.sh old mode 100755 new mode 100644 index 97bce61d17..2d779dd6c8 --- a/impls/bash/step0_repl.sh +++ b/impls/bash/step0_repl.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - READ () { read -u 0 -e -p "user> " r } diff --git a/impls/bash/step1_read_print.sh b/impls/bash/step1_read_print.sh old mode 100755 new mode 100644 index 8011fa6b86..b0eba83196 --- a/impls/bash/step1_read_print.sh +++ b/impls/bash/step1_read_print.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - source $(dirname $0)/reader.sh source $(dirname $0)/printer.sh diff --git a/impls/bash/step2_eval.sh b/impls/bash/step2_eval.sh old mode 100755 new mode 100644 index 54d75885c3..ad0c15a255 --- a/impls/bash/step2_eval.sh +++ b/impls/bash/step2_eval.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - source $(dirname $0)/reader.sh source $(dirname $0)/printer.sh diff --git a/impls/bash/step3_env.sh b/impls/bash/step3_env.sh old mode 100755 new mode 100644 index ba46e54306..f4433c48cb --- a/impls/bash/step3_env.sh +++ b/impls/bash/step3_env.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - source $(dirname $0)/reader.sh source $(dirname $0)/printer.sh source $(dirname $0)/env.sh diff --git a/impls/bash/step4_if_fn_do.sh b/impls/bash/step4_if_fn_do.sh old mode 100755 new mode 100644 index 24b45965fd..129e8959d4 --- a/impls/bash/step4_if_fn_do.sh +++ b/impls/bash/step4_if_fn_do.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - source $(dirname $0)/reader.sh source $(dirname $0)/printer.sh source $(dirname $0)/env.sh diff --git a/impls/bash/step5_tco.sh b/impls/bash/step5_tco.sh old mode 100755 new mode 100644 index 5e30751000..c81b1ea2bf --- a/impls/bash/step5_tco.sh +++ b/impls/bash/step5_tco.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - source $(dirname $0)/reader.sh source $(dirname $0)/printer.sh source $(dirname $0)/env.sh diff --git a/impls/bash/step6_file.sh b/impls/bash/step6_file.sh old mode 100755 new mode 100644 index b87cbc1986..e4d0d9c202 --- a/impls/bash/step6_file.sh +++ b/impls/bash/step6_file.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - source $(dirname $0)/reader.sh source $(dirname $0)/printer.sh source $(dirname $0)/env.sh diff --git a/impls/bash/step7_quote.sh b/impls/bash/step7_quote.sh old mode 100755 new mode 100644 index dc046f9fc2..0f0183e3b3 --- a/impls/bash/step7_quote.sh +++ b/impls/bash/step7_quote.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - source $(dirname $0)/reader.sh source $(dirname $0)/printer.sh source $(dirname $0)/env.sh diff --git a/impls/bash/step8_macros.sh b/impls/bash/step8_macros.sh old mode 100755 new mode 100644 index 64710610e2..d832170e05 --- a/impls/bash/step8_macros.sh +++ b/impls/bash/step8_macros.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - source $(dirname $0)/reader.sh source $(dirname $0)/printer.sh source $(dirname $0)/env.sh diff --git a/impls/bash/step9_try.sh b/impls/bash/step9_try.sh old mode 100755 new mode 100644 index bc6336ac34..7749c1b639 --- a/impls/bash/step9_try.sh +++ b/impls/bash/step9_try.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - source $(dirname $0)/reader.sh source $(dirname $0)/printer.sh source $(dirname $0)/env.sh diff --git a/impls/bash/stepA_mal.sh b/impls/bash/stepA_mal.sh old mode 100755 new mode 100644 index f65b4b1db2..ba81dffd3c --- a/impls/bash/stepA_mal.sh +++ b/impls/bash/stepA_mal.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - source $(dirname $0)/reader.sh source $(dirname $0)/printer.sh source $(dirname $0)/env.sh diff --git a/impls/basic/step0_repl.in.bas b/impls/basic/step0_repl.in.bas old mode 100755 new mode 100644 diff --git a/impls/basic/step1_read_print.in.bas b/impls/basic/step1_read_print.in.bas old mode 100755 new mode 100644 diff --git a/impls/basic/step2_eval.in.bas b/impls/basic/step2_eval.in.bas old mode 100755 new mode 100644 diff --git a/impls/basic/step3_env.in.bas b/impls/basic/step3_env.in.bas old mode 100755 new mode 100644 diff --git a/impls/basic/step4_if_fn_do.in.bas b/impls/basic/step4_if_fn_do.in.bas old mode 100755 new mode 100644 diff --git a/impls/basic/step5_tco.in.bas b/impls/basic/step5_tco.in.bas old mode 100755 new mode 100644 diff --git a/impls/basic/step6_file.in.bas b/impls/basic/step6_file.in.bas old mode 100755 new mode 100644 diff --git a/impls/basic/step7_quote.in.bas b/impls/basic/step7_quote.in.bas old mode 100755 new mode 100644 diff --git a/impls/basic/step8_macros.in.bas b/impls/basic/step8_macros.in.bas old mode 100755 new mode 100644 diff --git a/impls/basic/step9_try.in.bas b/impls/basic/step9_try.in.bas old mode 100755 new mode 100644 diff --git a/impls/basic/stepA_mal.in.bas b/impls/basic/stepA_mal.in.bas old mode 100755 new mode 100644 diff --git a/impls/crystal/step0_repl.cr b/impls/crystal/step0_repl.cr old mode 100755 new mode 100644 index a9c67d68f2..b6a1bfba32 --- a/impls/crystal/step0_repl.cr +++ b/impls/crystal/step0_repl.cr @@ -1,5 +1,3 @@ -#! /usr/bin/env crystal run - require "readline" # Note: diff --git a/impls/crystal/step1_read_print.cr b/impls/crystal/step1_read_print.cr old mode 100755 new mode 100644 index 4d7195895e..8c5ddffb9e --- a/impls/crystal/step1_read_print.cr +++ b/impls/crystal/step1_read_print.cr @@ -1,5 +1,3 @@ -#! /usr/bin/env crystal run - require "readline" require "./reader" require "./printer" diff --git a/impls/crystal/step2_eval.cr b/impls/crystal/step2_eval.cr old mode 100755 new mode 100644 index f8713571cd..dd8f2533d1 --- a/impls/crystal/step2_eval.cr +++ b/impls/crystal/step2_eval.cr @@ -1,5 +1,3 @@ -#! /usr/bin/env crystal run - require "readline" require "./reader" require "./printer" diff --git a/impls/crystal/step3_env.cr b/impls/crystal/step3_env.cr old mode 100755 new mode 100644 index a17d79779f..fd77be8e46 --- a/impls/crystal/step3_env.cr +++ b/impls/crystal/step3_env.cr @@ -1,5 +1,3 @@ -#! /usr/bin/env crystal run - require "readline" require "./reader" require "./printer" diff --git a/impls/crystal/step4_if_fn_do.cr b/impls/crystal/step4_if_fn_do.cr old mode 100755 new mode 100644 index fb33c8911d..251629332d --- a/impls/crystal/step4_if_fn_do.cr +++ b/impls/crystal/step4_if_fn_do.cr @@ -1,5 +1,3 @@ -#! /usr/bin/env crystal run - require "readline" require "./reader" require "./printer" diff --git a/impls/crystal/step5_tco.cr b/impls/crystal/step5_tco.cr old mode 100755 new mode 100644 index 508ed0b176..72a9489606 --- a/impls/crystal/step5_tco.cr +++ b/impls/crystal/step5_tco.cr @@ -1,5 +1,3 @@ -#! /usr/bin/env crystal run - require "readline" require "./reader" require "./printer" diff --git a/impls/crystal/step6_file.cr b/impls/crystal/step6_file.cr old mode 100755 new mode 100644 index a7a95e170c..2eff3ba8d0 --- a/impls/crystal/step6_file.cr +++ b/impls/crystal/step6_file.cr @@ -1,5 +1,3 @@ -#! /usr/bin/env crystal run - require "readline" require "./reader" require "./printer" diff --git a/impls/crystal/step7_quote.cr b/impls/crystal/step7_quote.cr old mode 100755 new mode 100644 index b935061fa2..0455d143db --- a/impls/crystal/step7_quote.cr +++ b/impls/crystal/step7_quote.cr @@ -1,5 +1,3 @@ -#! /usr/bin/env crystal run - require "readline" require "./reader" require "./printer" diff --git a/impls/crystal/step8_macros.cr b/impls/crystal/step8_macros.cr old mode 100755 new mode 100644 index 2c7ac4e755..57b6063d82 --- a/impls/crystal/step8_macros.cr +++ b/impls/crystal/step8_macros.cr @@ -1,5 +1,3 @@ -#! /usr/bin/env crystal run - require "readline" require "./reader" require "./printer" diff --git a/impls/crystal/step9_try.cr b/impls/crystal/step9_try.cr old mode 100755 new mode 100644 index 984158b28f..bfc8a70572 --- a/impls/crystal/step9_try.cr +++ b/impls/crystal/step9_try.cr @@ -1,5 +1,3 @@ -#! /usr/bin/env crystal run - require "readline" require "./reader" require "./printer" diff --git a/impls/crystal/stepA_mal.cr b/impls/crystal/stepA_mal.cr old mode 100755 new mode 100644 index 2857c89d13..65fb8e9f8b --- a/impls/crystal/stepA_mal.cr +++ b/impls/crystal/stepA_mal.cr @@ -1,5 +1,3 @@ -#! /usr/bin/env crystal run - require "colorize" require "readline" diff --git a/impls/factor/step0_repl/step0_repl.factor b/impls/factor/step0_repl/step0_repl.factor old mode 100755 new mode 100644 diff --git a/impls/factor/step1_read_print/step1_read_print.factor b/impls/factor/step1_read_print/step1_read_print.factor old mode 100755 new mode 100644 diff --git a/impls/factor/step2_eval/step2_eval.factor b/impls/factor/step2_eval/step2_eval.factor old mode 100755 new mode 100644 diff --git a/impls/factor/step3_env/step3_env.factor b/impls/factor/step3_env/step3_env.factor old mode 100755 new mode 100644 diff --git a/impls/factor/step4_if_fn_do/step4_if_fn_do.factor b/impls/factor/step4_if_fn_do/step4_if_fn_do.factor old mode 100755 new mode 100644 diff --git a/impls/factor/step5_tco/step5_tco.factor b/impls/factor/step5_tco/step5_tco.factor old mode 100755 new mode 100644 diff --git a/impls/factor/step6_file/step6_file.factor b/impls/factor/step6_file/step6_file.factor old mode 100755 new mode 100644 diff --git a/impls/factor/step7_quote/step7_quote.factor b/impls/factor/step7_quote/step7_quote.factor old mode 100755 new mode 100644 diff --git a/impls/factor/step8_macros/step8_macros.factor b/impls/factor/step8_macros/step8_macros.factor old mode 100755 new mode 100644 diff --git a/impls/factor/step9_try/step9_try.factor b/impls/factor/step9_try/step9_try.factor old mode 100755 new mode 100644 diff --git a/impls/factor/stepA_mal/stepA_mal.factor b/impls/factor/stepA_mal/stepA_mal.factor old mode 100755 new mode 100644 diff --git a/impls/hy/run b/impls/hy/run index e203849508..7f69c4e5d9 100755 --- a/impls/hy/run +++ b/impls/hy/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal}.hy "${@}" +exec hy $(dirname $0)/${STEP:-stepA_mal}.hy "${@}" diff --git a/impls/hy/step0_repl.hy b/impls/hy/step0_repl.hy old mode 100755 new mode 100644 index d651bbf0ef..5b837b721b --- a/impls/hy/step0_repl.hy +++ b/impls/hy/step0_repl.hy @@ -1,5 +1,3 @@ -#!/usr/bin/env hy - (defn READ [str] str) diff --git a/impls/hy/step1_read_print.hy b/impls/hy/step1_read_print.hy old mode 100755 new mode 100644 index ba8670e14b..61af6fda01 --- a/impls/hy/step1_read_print.hy +++ b/impls/hy/step1_read_print.hy @@ -1,5 +1,3 @@ -#!/usr/bin/env hy - (import sys traceback) (import [reader [read-str Blank]]) (import [printer [pr-str]]) diff --git a/impls/hy/step2_eval.hy b/impls/hy/step2_eval.hy old mode 100755 new mode 100644 index adfc2a16a6..1ade3ab4dd --- a/impls/hy/step2_eval.hy +++ b/impls/hy/step2_eval.hy @@ -1,5 +1,3 @@ -#!/usr/bin/env hy - (import sys traceback) (import [reader [read-str Blank]]) (import [printer [pr-str]]) diff --git a/impls/hy/step3_env.hy b/impls/hy/step3_env.hy old mode 100755 new mode 100644 index 26fca8fa7a..1a92f421f7 --- a/impls/hy/step3_env.hy +++ b/impls/hy/step3_env.hy @@ -1,5 +1,3 @@ -#!/usr/bin/env hy - (import [hy.models [HySymbol :as Sym]]) (import sys traceback) (import [reader [read-str Blank]]) diff --git a/impls/hy/step4_if_fn_do.hy b/impls/hy/step4_if_fn_do.hy old mode 100755 new mode 100644 index ae01bf32a5..c65b49c991 --- a/impls/hy/step4_if_fn_do.hy +++ b/impls/hy/step4_if_fn_do.hy @@ -1,5 +1,3 @@ -#!/usr/bin/env hy - (import [hy.models [HySymbol :as Sym]]) (import sys traceback) (import [mal_types [MalException]]) diff --git a/impls/hy/step5_tco.hy b/impls/hy/step5_tco.hy old mode 100755 new mode 100644 index 6b364657ab..6beef1a319 --- a/impls/hy/step5_tco.hy +++ b/impls/hy/step5_tco.hy @@ -1,5 +1,3 @@ -#!/usr/bin/env hy - (import [hy.models [HySymbol :as Sym]]) (import sys traceback) (import [mal_types [MalException]]) diff --git a/impls/hy/step6_file.hy b/impls/hy/step6_file.hy old mode 100755 new mode 100644 index 9cf4c7380a..45f871aff1 --- a/impls/hy/step6_file.hy +++ b/impls/hy/step6_file.hy @@ -1,5 +1,3 @@ -#!/usr/bin/env hy - (import [hy.models [HyString :as Str HySymbol :as Sym]]) (import sys traceback) (import [mal_types [MalException]]) diff --git a/impls/hy/step7_quote.hy b/impls/hy/step7_quote.hy old mode 100755 new mode 100644 index 757852db5f..de7252f2de --- a/impls/hy/step7_quote.hy +++ b/impls/hy/step7_quote.hy @@ -1,5 +1,3 @@ -#!/usr/bin/env hy - (import [hy.models [HyString :as Str HySymbol :as Sym]]) (import sys traceback) (import [mal_types [MalException]]) diff --git a/impls/hy/step8_macros.hy b/impls/hy/step8_macros.hy old mode 100755 new mode 100644 index 97ee0ee46c..806914b5a6 --- a/impls/hy/step8_macros.hy +++ b/impls/hy/step8_macros.hy @@ -1,5 +1,3 @@ -#!/usr/bin/env hy - (import [hy.models [HyString :as Str HySymbol :as Sym]]) (import sys traceback) (import [mal_types [MalException]]) diff --git a/impls/hy/step9_try.hy b/impls/hy/step9_try.hy old mode 100755 new mode 100644 index 5dc44a0cf0..f852b53fa7 --- a/impls/hy/step9_try.hy +++ b/impls/hy/step9_try.hy @@ -1,5 +1,3 @@ -#!/usr/bin/env hy - (import [hy.models [HyString :as Str HySymbol :as Sym]]) (import sys traceback) (import [mal_types [MalException]]) diff --git a/impls/hy/stepA_mal.hy b/impls/hy/stepA_mal.hy old mode 100755 new mode 100644 index 3e881fdab6..dbffa8835e --- a/impls/hy/stepA_mal.hy +++ b/impls/hy/stepA_mal.hy @@ -1,5 +1,3 @@ -#!/usr/bin/env hy - (import [hy.models [HyString :as Str HySymbol :as Sym]]) (import sys traceback) (import [mal_types [MalException]]) diff --git a/impls/julia/step0_repl.jl b/impls/julia/step0_repl.jl old mode 100755 new mode 100644 index 049cde1418..e26734a05e --- a/impls/julia/step0_repl.jl +++ b/impls/julia/step0_repl.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - push!(LOAD_PATH, pwd(), "/usr/share/julia/base") import readline_mod diff --git a/impls/julia/step1_read_print.jl b/impls/julia/step1_read_print.jl old mode 100755 new mode 100644 index 604b1f9c3d..9991ebd308 --- a/impls/julia/step1_read_print.jl +++ b/impls/julia/step1_read_print.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - push!(LOAD_PATH, pwd(), "/usr/share/julia/base") import readline_mod import reader diff --git a/impls/julia/step2_eval.jl b/impls/julia/step2_eval.jl old mode 100755 new mode 100644 index b64ca9e17c..cc97dbf81e --- a/impls/julia/step2_eval.jl +++ b/impls/julia/step2_eval.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - push!(LOAD_PATH, pwd(), "/usr/share/julia/base") import readline_mod import reader diff --git a/impls/julia/step3_env.jl b/impls/julia/step3_env.jl old mode 100755 new mode 100644 index b1cdd6c595..e4d8a895de --- a/impls/julia/step3_env.jl +++ b/impls/julia/step3_env.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - push!(LOAD_PATH, pwd(), "/usr/share/julia/base") import readline_mod import reader diff --git a/impls/julia/step4_if_fn_do.jl b/impls/julia/step4_if_fn_do.jl old mode 100755 new mode 100644 index 70334f4337..ffb421eba0 --- a/impls/julia/step4_if_fn_do.jl +++ b/impls/julia/step4_if_fn_do.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - push!(LOAD_PATH, pwd(), "/usr/share/julia/base") import readline_mod import reader diff --git a/impls/julia/step5_tco.jl b/impls/julia/step5_tco.jl old mode 100755 new mode 100644 index 08ed0659cf..9741829cef --- a/impls/julia/step5_tco.jl +++ b/impls/julia/step5_tco.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - push!(LOAD_PATH, pwd(), "/usr/share/julia/base") import readline_mod import reader diff --git a/impls/julia/step6_file.jl b/impls/julia/step6_file.jl old mode 100755 new mode 100644 index 0c39d0516e..3654228609 --- a/impls/julia/step6_file.jl +++ b/impls/julia/step6_file.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - push!(LOAD_PATH, pwd(), "/usr/share/julia/base") import readline_mod import reader diff --git a/impls/julia/step7_quote.jl b/impls/julia/step7_quote.jl old mode 100755 new mode 100644 index 86148cfd67..66b43232d5 --- a/impls/julia/step7_quote.jl +++ b/impls/julia/step7_quote.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - push!(LOAD_PATH, pwd(), "/usr/share/julia/base") import readline_mod import reader diff --git a/impls/julia/step8_macros.jl b/impls/julia/step8_macros.jl old mode 100755 new mode 100644 index 5dee5a32e1..ef460889bd --- a/impls/julia/step8_macros.jl +++ b/impls/julia/step8_macros.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - push!(LOAD_PATH, pwd(), "/usr/share/julia/base") import readline_mod import reader diff --git a/impls/julia/step9_try.jl b/impls/julia/step9_try.jl old mode 100755 new mode 100644 index 73c18d01df..ca902b98a1 --- a/impls/julia/step9_try.jl +++ b/impls/julia/step9_try.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - push!(LOAD_PATH, pwd(), "/usr/share/julia/base") import readline_mod import reader diff --git a/impls/julia/stepA_mal.jl b/impls/julia/stepA_mal.jl old mode 100755 new mode 100644 index efeabef3e6..6f71851eed --- a/impls/julia/stepA_mal.jl +++ b/impls/julia/stepA_mal.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - push!(LOAD_PATH, pwd(), "/usr/share/julia/base") import readline_mod import reader diff --git a/impls/lua/step0_repl.lua b/impls/lua/step0_repl.lua old mode 100755 new mode 100644 index bb082a599d..94290842f8 --- a/impls/lua/step0_repl.lua +++ b/impls/lua/step0_repl.lua @@ -1,5 +1,3 @@ -#!/usr/bin/env lua - local readline = require('readline') function READ(str) diff --git a/impls/lua/step1_read_print.lua b/impls/lua/step1_read_print.lua old mode 100755 new mode 100644 index 78cde8c1fe..db7ec5d2dd --- a/impls/lua/step1_read_print.lua +++ b/impls/lua/step1_read_print.lua @@ -1,5 +1,3 @@ -#!/usr/bin/env lua - local readline = require('readline') local types = require('types') local reader = require('reader') diff --git a/impls/lua/step2_eval.lua b/impls/lua/step2_eval.lua old mode 100755 new mode 100644 index 0bb44d2a26..3259c87ca1 --- a/impls/lua/step2_eval.lua +++ b/impls/lua/step2_eval.lua @@ -1,5 +1,3 @@ -#!/usr/bin/env lua - local table = require('table') local readline = require('readline') diff --git a/impls/lua/step3_env.lua b/impls/lua/step3_env.lua old mode 100755 new mode 100644 index 297083deed..93afe5d885 --- a/impls/lua/step3_env.lua +++ b/impls/lua/step3_env.lua @@ -1,5 +1,3 @@ -#!/usr/bin/env lua - local table = require('table') local readline = require('readline') diff --git a/impls/lua/step4_if_fn_do.lua b/impls/lua/step4_if_fn_do.lua old mode 100755 new mode 100644 index f69c2379ed..d89653c391 --- a/impls/lua/step4_if_fn_do.lua +++ b/impls/lua/step4_if_fn_do.lua @@ -1,5 +1,3 @@ -#!/usr/bin/env lua - local table = require('table') local readline = require('readline') diff --git a/impls/lua/step5_tco.lua b/impls/lua/step5_tco.lua old mode 100755 new mode 100644 index 923a148357..d985db589a --- a/impls/lua/step5_tco.lua +++ b/impls/lua/step5_tco.lua @@ -1,5 +1,3 @@ -#!/usr/bin/env lua - local table = require('table') local readline = require('readline') diff --git a/impls/lua/step6_file.lua b/impls/lua/step6_file.lua old mode 100755 new mode 100644 index 2f5abf7d57..2d8a952734 --- a/impls/lua/step6_file.lua +++ b/impls/lua/step6_file.lua @@ -1,5 +1,3 @@ -#!/usr/bin/env lua - local table = require('table') local readline = require('readline') diff --git a/impls/lua/step7_quote.lua b/impls/lua/step7_quote.lua old mode 100755 new mode 100644 index 67de77665f..0a334d58d0 --- a/impls/lua/step7_quote.lua +++ b/impls/lua/step7_quote.lua @@ -1,5 +1,3 @@ -#!/usr/bin/env lua - local table = require('table') local readline = require('readline') diff --git a/impls/lua/step8_macros.lua b/impls/lua/step8_macros.lua old mode 100755 new mode 100644 index ce12dc864e..b33ffb8f88 --- a/impls/lua/step8_macros.lua +++ b/impls/lua/step8_macros.lua @@ -1,5 +1,3 @@ -#!/usr/bin/env lua - local table = require('table') local readline = require('readline') diff --git a/impls/lua/step9_try.lua b/impls/lua/step9_try.lua old mode 100755 new mode 100644 index a6fe507d5f..2634ac953a --- a/impls/lua/step9_try.lua +++ b/impls/lua/step9_try.lua @@ -1,5 +1,3 @@ -#!/usr/bin/env lua - local table = require('table') local readline = require('readline') diff --git a/impls/lua/stepA_mal.lua b/impls/lua/stepA_mal.lua old mode 100755 new mode 100644 index 242b1cdda4..76f614966e --- a/impls/lua/stepA_mal.lua +++ b/impls/lua/stepA_mal.lua @@ -1,5 +1,3 @@ -#!/usr/bin/env lua - local table = require('table') package.path = '../lua/?.lua;' .. package.path diff --git a/impls/make/reader.mk b/impls/make/reader.mk old mode 100755 new mode 100644 diff --git a/impls/perl/step0_repl.pl b/impls/perl/step0_repl.pl index 2947178df3..6d062f9995 100644 --- a/impls/perl/step0_repl.pl +++ b/impls/perl/step0_repl.pl @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use File::Basename 'dirname'; diff --git a/impls/perl/step1_read_print.pl b/impls/perl/step1_read_print.pl index 43f2d82fcf..4795044404 100644 --- a/impls/perl/step1_read_print.pl +++ b/impls/perl/step1_read_print.pl @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use File::Basename 'dirname'; diff --git a/impls/perl/step2_eval.pl b/impls/perl/step2_eval.pl index 23bccdc69f..648f40e2af 100644 --- a/impls/perl/step2_eval.pl +++ b/impls/perl/step2_eval.pl @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use File::Basename 'dirname'; diff --git a/impls/perl/step3_env.pl b/impls/perl/step3_env.pl index 9b09031d8a..02e87ac0e3 100644 --- a/impls/perl/step3_env.pl +++ b/impls/perl/step3_env.pl @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use File::Basename 'dirname'; diff --git a/impls/perl/step4_if_fn_do.pl b/impls/perl/step4_if_fn_do.pl index df4b825302..8b165fcd5f 100644 --- a/impls/perl/step4_if_fn_do.pl +++ b/impls/perl/step4_if_fn_do.pl @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use File::Basename 'dirname'; diff --git a/impls/perl/step5_tco.pl b/impls/perl/step5_tco.pl index 7d2460de36..6f4f04e998 100644 --- a/impls/perl/step5_tco.pl +++ b/impls/perl/step5_tco.pl @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings FATAL => 'recursion'; use File::Basename 'dirname'; diff --git a/impls/perl/step6_file.pl b/impls/perl/step6_file.pl index e0eca83ec5..9c677cc585 100644 --- a/impls/perl/step6_file.pl +++ b/impls/perl/step6_file.pl @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings FATAL => 'recursion'; use File::Basename 'dirname'; diff --git a/impls/perl/step7_quote.pl b/impls/perl/step7_quote.pl index ceee9c894f..0891ae9886 100644 --- a/impls/perl/step7_quote.pl +++ b/impls/perl/step7_quote.pl @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings FATAL => 'recursion'; use File::Basename 'dirname'; diff --git a/impls/perl/step8_macros.pl b/impls/perl/step8_macros.pl index aee1bb8274..bd9b3a888c 100644 --- a/impls/perl/step8_macros.pl +++ b/impls/perl/step8_macros.pl @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings FATAL => 'recursion'; use File::Basename 'dirname'; diff --git a/impls/perl/step9_try.pl b/impls/perl/step9_try.pl index 3612fba99d..73bddfd2ed 100644 --- a/impls/perl/step9_try.pl +++ b/impls/perl/step9_try.pl @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings FATAL => 'recursion'; use File::Basename 'dirname'; diff --git a/impls/perl/stepA_mal.pl b/impls/perl/stepA_mal.pl index e48046d504..609df2613a 100644 --- a/impls/perl/stepA_mal.pl +++ b/impls/perl/stepA_mal.pl @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings FATAL => 'recursion'; use File::Basename 'dirname'; diff --git a/impls/plpgsql/init.sql b/impls/plpgsql/init.sql old mode 100755 new mode 100644 diff --git a/impls/racket/step0_repl.rkt b/impls/racket/step0_repl.rkt old mode 100755 new mode 100644 index 643d132fa2..8cd3913fa9 --- a/impls/racket/step0_repl.rkt +++ b/impls/racket/step0_repl.rkt @@ -1,4 +1,3 @@ -#!/usr/bin/env racket #lang racket (require "readline.rkt" "types.rkt") diff --git a/impls/racket/step1_read_print.rkt b/impls/racket/step1_read_print.rkt old mode 100755 new mode 100644 index a5d8ac7761..53a64b4382 --- a/impls/racket/step1_read_print.rkt +++ b/impls/racket/step1_read_print.rkt @@ -1,4 +1,3 @@ -#!/usr/bin/env racket #lang racket (require "readline.rkt" "types.rkt" "reader.rkt" "printer.rkt") diff --git a/impls/racket/step2_eval.rkt b/impls/racket/step2_eval.rkt old mode 100755 new mode 100644 index 7ea1ce8f5d..08ac5a2ee6 --- a/impls/racket/step2_eval.rkt +++ b/impls/racket/step2_eval.rkt @@ -1,4 +1,3 @@ -#!/usr/bin/env racket #lang racket (require "types.rkt" "readline.rkt" "reader.rkt" "printer.rkt") diff --git a/impls/racket/step3_env.rkt b/impls/racket/step3_env.rkt old mode 100755 new mode 100644 index 8ecd818507..469e07fb8f --- a/impls/racket/step3_env.rkt +++ b/impls/racket/step3_env.rkt @@ -1,4 +1,3 @@ -#!/usr/bin/env racket #lang racket (require "readline.rkt" "types.rkt" "reader.rkt" "printer.rkt" diff --git a/impls/racket/step4_if_fn_do.rkt b/impls/racket/step4_if_fn_do.rkt old mode 100755 new mode 100644 index 44af35c119..28a46b18e2 --- a/impls/racket/step4_if_fn_do.rkt +++ b/impls/racket/step4_if_fn_do.rkt @@ -1,4 +1,3 @@ -#!/usr/bin/env racket #lang racket (require "readline.rkt" "types.rkt" "reader.rkt" "printer.rkt" diff --git a/impls/racket/step5_tco.rkt b/impls/racket/step5_tco.rkt old mode 100755 new mode 100644 index 880e05ae5c..2d2f3defaf --- a/impls/racket/step5_tco.rkt +++ b/impls/racket/step5_tco.rkt @@ -1,4 +1,3 @@ -#!/usr/bin/env racket #lang racket (require "readline.rkt" "types.rkt" "reader.rkt" "printer.rkt" diff --git a/impls/racket/step6_file.rkt b/impls/racket/step6_file.rkt old mode 100755 new mode 100644 index 6e1645bce9..783978ed61 --- a/impls/racket/step6_file.rkt +++ b/impls/racket/step6_file.rkt @@ -1,4 +1,3 @@ -#!/usr/bin/env racket #lang racket (require "readline.rkt" "types.rkt" "reader.rkt" "printer.rkt" diff --git a/impls/racket/step7_quote.rkt b/impls/racket/step7_quote.rkt old mode 100755 new mode 100644 index d9257f4889..f61aa7d000 --- a/impls/racket/step7_quote.rkt +++ b/impls/racket/step7_quote.rkt @@ -1,4 +1,3 @@ -#!/usr/bin/env racket #lang racket (require "readline.rkt" "types.rkt" "reader.rkt" "printer.rkt" diff --git a/impls/racket/step8_macros.rkt b/impls/racket/step8_macros.rkt old mode 100755 new mode 100644 index 864093047e..88a6d36567 --- a/impls/racket/step8_macros.rkt +++ b/impls/racket/step8_macros.rkt @@ -1,4 +1,3 @@ -#!/usr/bin/env racket #lang racket (require "readline.rkt" "types.rkt" "reader.rkt" "printer.rkt" diff --git a/impls/racket/step9_try.rkt b/impls/racket/step9_try.rkt old mode 100755 new mode 100644 index c8534d3b2b..ad42d983dc --- a/impls/racket/step9_try.rkt +++ b/impls/racket/step9_try.rkt @@ -1,4 +1,3 @@ -#!/usr/bin/env racket #lang racket (require "readline.rkt" "types.rkt" "reader.rkt" "printer.rkt" diff --git a/impls/racket/stepA_mal.rkt b/impls/racket/stepA_mal.rkt old mode 100755 new mode 100644 index c94bb80137..83cb4d13aa --- a/impls/racket/stepA_mal.rkt +++ b/impls/racket/stepA_mal.rkt @@ -1,4 +1,3 @@ -#!/usr/bin/env racket #lang racket (require "readline.rkt" "types.rkt" "reader.rkt" "printer.rkt" diff --git a/impls/wasm/run b/impls/wasm/run index 7d4fed5185..29c44131c2 100755 --- a/impls/wasm/run +++ b/impls/wasm/run @@ -14,5 +14,5 @@ wace_libc) wace_fooboot) echo >&2 "wace_fooboot mode not yet supported" ;; node|js|*) - exec ./run.js $(dirname $0)/${STEP:-stepA_mal}.wasm "${@}" ;; + exec node run.js $(dirname $0)/${STEP:-stepA_mal}.wasm "${@}" ;; esac diff --git a/impls/wasm/run.js b/impls/wasm/run.js old mode 100755 new mode 100644 index 2deaa5e53c..59a705583d --- a/impls/wasm/run.js +++ b/impls/wasm/run.js @@ -1,5 +1,3 @@ -#!/usr/bin/env node - // Copyright Joel Martin // License MIT @@ -128,7 +126,7 @@ async function loadWebAssembly(filename, args) { async function main() { assert(process.argv.length >= 3, - 'Usage: ./run.js prog.wasm [ARGS...]') + 'Usage: node run.js prog.wasm [ARGS...]') const wasm = process.argv[2] const args = process.argv.slice(2) From 41fd2267c7fec81cfbd490c32286bad33373be31 Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Thu, 16 Apr 2026 19:29:23 +0200 Subject: [PATCH 04/10] Merge some run scripts [1/2] This change is split so that git shows meaningful diffs. --- impls/plpgsql/run | 2 -- impls/plsql/run | 2 -- impls/vhdl/run | 2 -- impls/vimscript/run | 3 --- 4 files changed, 9 deletions(-) delete mode 100755 impls/plpgsql/run delete mode 100755 impls/plsql/run delete mode 100755 impls/vhdl/run delete mode 100755 impls/vimscript/run diff --git a/impls/plpgsql/run b/impls/plpgsql/run deleted file mode 100755 index a16184e01a..0000000000 --- a/impls/plpgsql/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -exec $(dirname $0)/wrap.sh $(dirname $0)/${STEP:-stepA_mal}.sql "${@}" diff --git a/impls/plsql/run b/impls/plsql/run deleted file mode 100755 index a16184e01a..0000000000 --- a/impls/plsql/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -exec $(dirname $0)/wrap.sh $(dirname $0)/${STEP:-stepA_mal}.sql "${@}" diff --git a/impls/vhdl/run b/impls/vhdl/run deleted file mode 100755 index ca50d3f82b..0000000000 --- a/impls/vhdl/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -exec $(dirname $0)/run_vhdl.sh $(dirname $0)/${STEP:-stepA_mal} "${@}" diff --git a/impls/vimscript/run b/impls/vimscript/run deleted file mode 100755 index 007df20bdf..0000000000 --- a/impls/vimscript/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -cd $(dirname $0) -exec ./run_vimscript.sh ./${STEP:-stepA_mal}.vim "${@}" From a657d3df176da15d842475732842bfec778ac479 Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Sat, 18 Apr 2026 19:30:43 +0200 Subject: [PATCH 05/10] Merge some run scripts [2/2] --- impls/plpgsql/{wrap.sh => run} | 6 +++--- impls/plsql/{wrap.sh => run} | 4 ++-- impls/vhdl/{run_vhdl.sh => run} | 5 ++--- impls/vimscript/{run_vimscript.sh => run} | 3 +-- 4 files changed, 8 insertions(+), 10 deletions(-) rename impls/plpgsql/{wrap.sh => run} (94%) rename impls/plsql/{wrap.sh => run} (98%) rename impls/vhdl/{run_vhdl.sh => run} (86%) rename impls/vimscript/{run_vimscript.sh => run} (90%) diff --git a/impls/plpgsql/wrap.sh b/impls/plpgsql/run similarity index 94% rename from impls/plpgsql/wrap.sh rename to impls/plpgsql/run index e14c072d6a..b4237611be 100755 --- a/impls/plpgsql/wrap.sh +++ b/impls/plpgsql/run @@ -1,4 +1,5 @@ #!/usr/bin/env bash +step=${STEP:-stepA_mal}.sql RL_HISTORY_FILE=${HOME}/.mal-history SKIP_INIT="${SKIP_INIT:-}" @@ -25,8 +26,8 @@ cleanup () { trap "cleanup" TERM QUIT INT EXIT ${PSQL} -tc "SELECT 1 FROM pg_database WHERE datname = 'mal'" \ | grep -q 1 || ${PSQL} -c "CREATE DATABASE mal" -#[ "${SKIP_INIT}" ] || ${PSQL} -dmal -f $1 > /dev/null -[ "${SKIP_INIT}" ] || ${PSQL} -dmal -f $1 +#[ "${SKIP_INIT}" ] || ${PSQL} -dmal -f $step > /dev/null +[ "${SKIP_INIT}" ] || ${PSQL} -dmal -f $step ${PSQL} -dmal -c "SELECT io.open(0); SELECT io.open(1);" > /dev/null @@ -59,7 +60,6 @@ ${PSQL} -dmal -c "SELECT io.close(0);" > /dev/null STDIN_PID=$! res=0 -shift if [ $# -gt 0 ]; then # If there are command line arguments then run a command and exit args=$(for a in "$@"; do echo -n "\"$a\" "; done) diff --git a/impls/plsql/wrap.sh b/impls/plsql/run similarity index 98% rename from impls/plsql/wrap.sh rename to impls/plsql/run index c106ecb98b..39f9d037c1 100755 --- a/impls/plsql/wrap.sh +++ b/impls/plsql/run @@ -1,4 +1,5 @@ #!/usr/bin/env bash +step=${STEP:-stepA_mal}.sql RL_HISTORY_FILE=${HOME}/.mal-history SKIP_INIT="${SKIP_INIT:-}" @@ -17,7 +18,7 @@ trap "cleanup" TERM QUIT INT EXIT # Load the SQL code if [ -z "${SKIP_INIT}" ]; then - out=$(echo "" | ${SQLPLUS} @$1) + out=$(echo "" | ${SQLPLUS} @$step) if echo "${out}" | grep -vs "^No errors.$" \ | grep -si error >/dev/null; then #if echo "${out}" | grep -si error >/dev/null; then @@ -104,7 +105,6 @@ done FILE_PID=$! res=0 -shift if [ $# -gt 0 ]; then # If there are command line arguments then run a command and exit args=$(for a in "$@"; do echo -n "\"$a\" "; done) diff --git a/impls/vhdl/run_vhdl.sh b/impls/vhdl/run similarity index 86% rename from impls/vhdl/run_vhdl.sh rename to impls/vhdl/run index 14fbd35131..0d3a5d40c4 100755 --- a/impls/vhdl/run_vhdl.sh +++ b/impls/vhdl/run @@ -5,11 +5,10 @@ # vhdl_argv.tmp, and read the content of that file at the beginning of the VHDL # program. -bin="$1" -shift +bin="$(dirname $0)/${STEP:-stepA_mal}" for arg in "$@" ; do echo "$arg" done > vhdl_argv.tmp -$bin +exec $bin diff --git a/impls/vimscript/run_vimscript.sh b/impls/vimscript/run similarity index 90% rename from impls/vimscript/run_vimscript.sh rename to impls/vimscript/run index cf263c8f7f..6a98e91302 100755 --- a/impls/vimscript/run_vimscript.sh +++ b/impls/vimscript/run @@ -9,8 +9,7 @@ rundir=`dirname $0` export LD_LIBRARY_PATH=`readlink -f $rundir` -vimscriptfile="$1" -shift +vimscriptfile="$(dirname $0)/${STEP:-stepA_mal}.vim" if [ x$DEBUG = x ] ; then exec 2> /dev/null fi From 5b94c4592363d3b62199c6d0ca4427b4760da714 Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Sun, 19 Apr 2026 14:48:25 +0200 Subject: [PATCH 06/10] scheme: in run script, compute paths portably and on demand https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then --- impls/scheme/run | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/impls/scheme/run b/impls/scheme/run index 8cfd055ae2..acef8c0753 100755 --- a/impls/scheme/run +++ b/impls/scheme/run @@ -2,24 +2,28 @@ basedir=$(dirname $0) step=${STEP:-stepA_mal} -if [[ -e /usr/share/kawa/lib/kawa.jar ]]; then - kawa=/usr/share/kawa/lib/kawa.jar -elif [[ -e /usr/local/share/kawa/lib/kawa.jar ]]; then - kawa=/usr/local/share/kawa/lib/kawa.jar -fi - -if [[ $(which sash 2>/dev/null) ]]; then - sagittarius=sash -elif [[ $(which sagittarius 2>/dev/null) ]]; then - sagittarius=sagittarius -fi - case ${scheme_MODE:-chibi} in chibi) exec chibi-scheme -I$basedir $basedir/$step.scm "${@}" ;; - kawa) exec java -cp $kawa:$basedir/out $step "${@}" ;; + kawa) if [ -e /usr/share/kawa/lib/kawa.jar ]; then + kawa=/usr/share/kawa/lib/kawa.jar + elif [ -e /usr/local/share/kawa/lib/kawa.jar ]; then + kawa=/usr/local/share/kawa/lib/kawa.jar + else + echo >&2 'Failed to find kawa.jar.' + exit 1 + fi + exec java -cp $kawa:$basedir/out $step "${@}" ;; gauche) exec gosh -I$basedir $basedir/$step.scm "${@}" ;; chicken) CHICKEN_REPOSITORY=$basedir/eggs exec $basedir/$step "${@}" ;; - sagittarius) exec $sagittarius -n -L$basedir $basedir/$step.scm "${@}" ;; + sagittarius) if command -v sash >/dev/null 2>&1; then + sagittarius=sash + elif command -v sagittarius >/dev/null 2>&1; then + sagittarius=sagittarius + else + echo >&2 'Failed to find sash or sagittarius.' + exit 1 + fi + exec $sagittarius -n -L$basedir $basedir/$step.scm "${@}" ;; cyclone) exec $basedir/$step "${@}" ;; foment) exec foment $basedir/$step.scm "${@}" ;; *) echo "Invalid scheme_MODE: ${scheme_MODE}"; exit 2 ;; From 47c4d23d5a03f212b12eff7d60dd26cf2b13d2fe Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Mon, 20 Apr 2026 00:36:03 +0200 Subject: [PATCH 07/10] perl: (style) silent a warning about comparing an undefined value --- impls/perl/step0_repl.pl | 2 +- impls/perl/step1_read_print.pl | 2 +- impls/perl/step2_eval.pl | 2 +- impls/perl/step3_env.pl | 2 +- impls/perl/step4_if_fn_do.pl | 2 +- impls/perl/step5_tco.pl | 2 +- impls/perl/step6_file.pl | 2 +- impls/perl/step7_quote.pl | 2 +- impls/perl/step8_macros.pl | 2 +- impls/perl/step9_try.pl | 2 +- impls/perl/stepA_mal.pl | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/impls/perl/step0_repl.pl b/impls/perl/step0_repl.pl index 6d062f9995..a0018328a5 100644 --- a/impls/perl/step0_repl.pl +++ b/impls/perl/step0_repl.pl @@ -32,7 +32,7 @@ sub REP { } # Command line arguments -if ( $ARGV[0] eq '--raw' ) { +if ( @ARGV and $ARGV[0] eq '--raw' ) { set_rl_mode('raw'); shift @ARGV; } diff --git a/impls/perl/step1_read_print.pl b/impls/perl/step1_read_print.pl index 4795044404..36f1bd92e9 100644 --- a/impls/perl/step1_read_print.pl +++ b/impls/perl/step1_read_print.pl @@ -34,7 +34,7 @@ sub REP { } # Command line arguments -if ( $ARGV[0] eq '--raw' ) { +if ( @ARGV and $ARGV[0] eq '--raw' ) { set_rl_mode('raw'); shift @ARGV; } diff --git a/impls/perl/step2_eval.pl b/impls/perl/step2_eval.pl index 648f40e2af..6ed7b5b3c7 100644 --- a/impls/perl/step2_eval.pl +++ b/impls/perl/step2_eval.pl @@ -61,7 +61,7 @@ sub REP { } # Command line arguments -if ( $ARGV[0] eq '--raw' ) { +if ( @ARGV and $ARGV[0] eq '--raw' ) { set_rl_mode('raw'); shift @ARGV; } diff --git a/impls/perl/step3_env.pl b/impls/perl/step3_env.pl index 02e87ac0e3..8add028df0 100644 --- a/impls/perl/step3_env.pl +++ b/impls/perl/step3_env.pl @@ -91,7 +91,7 @@ sub REP { } # Command line arguments -if ( $ARGV[0] eq '--raw' ) { +if ( @ARGV and $ARGV[0] eq '--raw' ) { set_rl_mode('raw'); shift @ARGV; } diff --git a/impls/perl/step4_if_fn_do.pl b/impls/perl/step4_if_fn_do.pl index 8b165fcd5f..b4cc282aca 100644 --- a/impls/perl/step4_if_fn_do.pl +++ b/impls/perl/step4_if_fn_do.pl @@ -122,7 +122,7 @@ sub REP { } # Command line arguments -if ( $ARGV[0] eq '--raw' ) { +if ( @ARGV and $ARGV[0] eq '--raw' ) { set_rl_mode('raw'); shift @ARGV; } diff --git a/impls/perl/step5_tco.pl b/impls/perl/step5_tco.pl index 6f4f04e998..de59963b0b 100644 --- a/impls/perl/step5_tco.pl +++ b/impls/perl/step5_tco.pl @@ -132,7 +132,7 @@ sub REP { } # Command line arguments -if ( $ARGV[0] eq '--raw' ) { +if ( @ARGV and $ARGV[0] eq '--raw' ) { set_rl_mode('raw'); shift @ARGV; } diff --git a/impls/perl/step6_file.pl b/impls/perl/step6_file.pl index 9c677cc585..ce6c496fc0 100644 --- a/impls/perl/step6_file.pl +++ b/impls/perl/step6_file.pl @@ -132,7 +132,7 @@ sub REP { } # Command line arguments -if ( $ARGV[0] eq '--raw' ) { +if ( @ARGV and $ARGV[0] eq '--raw' ) { set_rl_mode('raw'); shift @ARGV; } diff --git a/impls/perl/step7_quote.pl b/impls/perl/step7_quote.pl index 0891ae9886..6042b83535 100644 --- a/impls/perl/step7_quote.pl +++ b/impls/perl/step7_quote.pl @@ -185,7 +185,7 @@ sub REP { } # Command line arguments -if ( $ARGV[0] eq '--raw' ) { +if ( @ARGV and $ARGV[0] eq '--raw' ) { set_rl_mode('raw'); shift @ARGV; } diff --git a/impls/perl/step8_macros.pl b/impls/perl/step8_macros.pl index bd9b3a888c..75c040a2f8 100644 --- a/impls/perl/step8_macros.pl +++ b/impls/perl/step8_macros.pl @@ -196,7 +196,7 @@ sub REP { } # Command line arguments -if ( $ARGV[0] eq '--raw' ) { +if ( @ARGV and $ARGV[0] eq '--raw' ) { set_rl_mode('raw'); shift @ARGV; } diff --git a/impls/perl/step9_try.pl b/impls/perl/step9_try.pl index 73bddfd2ed..c3311d1ed6 100644 --- a/impls/perl/step9_try.pl +++ b/impls/perl/step9_try.pl @@ -219,7 +219,7 @@ sub REP { } # Command line arguments -if ( $ARGV[0] eq '--raw' ) { +if ( @ARGV and $ARGV[0] eq '--raw' ) { set_rl_mode('raw'); shift @ARGV; } diff --git a/impls/perl/stepA_mal.pl b/impls/perl/stepA_mal.pl index 609df2613a..698f9fb148 100644 --- a/impls/perl/stepA_mal.pl +++ b/impls/perl/stepA_mal.pl @@ -219,7 +219,7 @@ sub REP { } # Command line arguments -if ( $ARGV[0] eq '--raw' ) { +if ( @ARGV and $ARGV[0] eq '--raw' ) { set_rl_mode('raw'); shift @ARGV; } From 2bac97ca3b74b0233bb4d88806e8df848dc533ed Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Mon, 20 Apr 2026 00:36:38 +0200 Subject: [PATCH 08/10] perl: set readline raw mode during tests --- Makefile | 2 +- impls/perl/run | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ff1cd7a643..6eda0955a2 100644 --- a/Makefile +++ b/Makefile @@ -168,7 +168,7 @@ get_run_prefix = $(strip $(foreach mode,$(call actual_impl,$(1))_MODE, \ # Takes impl and step # Returns the runtest command prefix (with runtest options) for testing the given step -get_runtest_cmd = $(call get_run_prefix,$(1),$(2),$(if $(filter cs fsharp mal tcl vb,$(1)),RAW=1,)) \ +get_runtest_cmd = $(call get_run_prefix,$(1),$(2),$(if $(filter cs fsharp mal perl tcl vb,$(1)),RAW=1)) \ ../../runtest.py $(opt_HARD) $(opt_DEFERRABLE) $(opt_OPTIONAL) $(call $(1)_TEST_OPTS) $(TEST_OPTS) # Takes impl and step diff --git a/impls/perl/run b/impls/perl/run index 4f255fe5fe..a388a0c3ce 100755 --- a/impls/perl/run +++ b/impls/perl/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec perl $(dirname $0)/${STEP:-stepA_mal}.pl "${@}" +exec perl $(dirname $0)/${STEP:-stepA_mal}.pl ${RAW:+--raw} "$@" From 7d81acc0d85d6839388e1a400d596b7e676a6a85 Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Sun, 19 Apr 2026 16:29:30 +0200 Subject: [PATCH 09/10] run scripts: improve style --- impls/ada.2/run | 2 +- impls/ada/run | 2 +- impls/awk/run | 2 +- impls/bash/run | 2 +- impls/basic/run | 12 ++++++++---- impls/bbc-basic/run | 2 +- impls/c.2/run | 2 +- impls/c/run | 2 +- impls/chuck/run | 20 ++++++++++++++------ impls/clojure/run | 13 +++++++------ impls/coffee/run | 2 +- impls/common-lisp/run | 2 +- impls/cpp/run | 2 +- impls/crystal/run | 2 +- impls/cs/run | 2 +- impls/d/run | 2 +- impls/dart/run | 2 +- impls/elisp/run | 4 +++- impls/elixir/run | 2 +- impls/elm/run | 2 +- impls/erlang/run | 2 +- impls/es6/run | 2 +- impls/factor/run | 3 ++- impls/fennel/run | 2 +- impls/forth/run | 2 +- impls/fsharp/run | 2 +- impls/gnu-smalltalk/run | 2 +- impls/go/run | 2 +- impls/groovy/run | 2 +- impls/guile/run | 2 +- impls/hare/run | 2 +- impls/haskell/run | 2 +- impls/haxe/run | 10 +++++----- impls/hy/run | 2 +- impls/janet/run | 2 +- impls/java/run | 17 ++++++++--------- impls/js/run | 2 +- impls/julia/run | 2 +- impls/kotlin/run | 2 +- impls/livescript/run | 2 +- impls/logo/run | 2 +- impls/lua/run | 2 +- impls/make/run | 2 +- impls/mal/run | 13 ++++++++----- impls/matlab/run | 12 +++++------- impls/miniMAL/run | 2 +- impls/nasm/run | 2 +- impls/nim/run | 2 +- impls/objc/run | 2 +- impls/objpascal/run | 2 +- impls/ocaml/run | 2 +- impls/perl6/run | 2 +- impls/php/run | 2 +- impls/picolisp/run | 2 +- impls/pike/run | 2 +- impls/powershell/run | 2 +- impls/prolog/run | 2 +- impls/ps/run | 2 +- impls/purs/run | 2 +- impls/python2/run | 2 +- impls/python3/run | 2 +- impls/r/run | 2 +- impls/racket/run | 2 +- impls/rexx/run | 2 +- impls/rpython/run | 2 +- impls/ruby.2/run | 2 +- impls/ruby/run | 2 +- impls/rust/run | 2 +- impls/scala/run | 2 +- impls/scheme/run | 16 ++++++++-------- impls/skew/run | 2 +- impls/sml/run | 2 +- impls/swift3/run | 2 +- impls/swift4/run | 2 +- impls/swift6/run | 2 +- impls/tcl/run | 2 +- impls/ts/run | 2 +- impls/vala/run | 2 +- impls/vb/run | 2 +- impls/vbs/run | 2 +- impls/vhdl/run | 2 +- impls/wasm/run | 15 +++++++-------- impls/wren/run | 2 +- impls/yorick/run | 2 +- impls/zig/run | 2 +- 85 files changed, 149 insertions(+), 134 deletions(-) diff --git a/impls/ada.2/run b/impls/ada.2/run index 6efdc3de32..57693e8022 100755 --- a/impls/ada.2/run +++ b/impls/ada.2/run @@ -1,2 +1,2 @@ #!/bin/sh -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/ada/run b/impls/ada/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/ada/run +++ b/impls/ada/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/awk/run b/impls/awk/run index 035bed1e3f..c3cfdf6044 100755 --- a/impls/awk/run +++ b/impls/awk/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec awk -f $(dirname $0)/${STEP:-stepA_mal}.awk "${@}" +exec awk -f $(dirname $0)/${STEP:-stepA_mal}.awk "$@" diff --git a/impls/bash/run b/impls/bash/run index 05081b9ce6..29e282a6af 100755 --- a/impls/bash/run +++ b/impls/bash/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec bash $(dirname $0)/${STEP:-stepA_mal}.sh "${@}" +exec bash $(dirname $0)/${STEP:-stepA_mal}.sh "$@" diff --git a/impls/basic/run b/impls/basic/run index 9b394f8c0b..82b00367bb 100755 --- a/impls/basic/run +++ b/impls/basic/run @@ -1,8 +1,12 @@ #!/usr/bin/env bash cd $(dirname $0) -(echo "(def! -*ARGS*- (list $(for a in "${@}"; do echo -n " \"${a}\""; done)))") > .args.mal +{ + printf '(def! -*ARGS*- (list' + [ $# = 0 ] || printf ' "%s"' "$@" + echo '))' +} > .args.mal case ${basic_MODE:-cbm} in - cbm) exec cbmbasic ${STEP:-stepA_mal}.bas "${@}" ;; - qbasic) exec ./${STEP:-stepA_mal} "${@}" ;; - *) echo "Invalid basic_MODE: ${basic_MODE}"; exit 2 ;; + cbm) exec cbmbasic ${STEP:-stepA_mal}.bas "$@" ;; + qbasic) exec ./${STEP:-stepA_mal} "$@" ;; + *) echo "Invalid basic_MODE: $basic_MODE"; exit 2 ;; esac diff --git a/impls/bbc-basic/run b/impls/bbc-basic/run index b3e2049a09..1e3b0523a0 100755 --- a/impls/bbc-basic/run +++ b/impls/bbc-basic/run @@ -1,3 +1,3 @@ #!/usr/bin/env bash exec "${BRANDY:-sbrandy}" -size 1024k \ - -path ../bbc-basic -quit $(dirname $0)/${STEP:-stepA_mal}.bas "${@}" + -path ../bbc-basic -quit $(dirname $0)/${STEP:-stepA_mal}.bas "$@" diff --git a/impls/c.2/run b/impls/c.2/run index 6efdc3de32..57693e8022 100755 --- a/impls/c.2/run +++ b/impls/c.2/run @@ -1,2 +1,2 @@ #!/bin/sh -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/c/run b/impls/c/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/c/run +++ b/impls/c/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/chuck/run b/impls/chuck/run index 99137daea7..7f7e1e5d97 100755 --- a/impls/chuck/run +++ b/impls/chuck/run @@ -1,11 +1,19 @@ #!/usr/bin/env bash +step=$(dirname $0)/${STEP:-stepA_mal}.ck + regex_chugin=${REGEX_CHUGIN:-/usr/local/lib/chuck/1.5.2.5/RegEx.chug} -if [[ ! -f "$regex_chugin" ]]; then - echo "Set \$REGEX_CHUGIN to the absolute path of RegEx.chug"; exit 1 +if [ ! -f "$regex_chugin" ]; then + echo 'Set $REGEX_CHUGIN to the absolute path of RegEx.chug' + exit 1 fi -imports=$(grep "^ *// *@import" "$(dirname $0)/${STEP:-stepA_mal}.ck" | awk '{print $3}') -imports=$(for i in ${imports}; do ls $(dirname $0)/${i}; done) -old_IFS="${IFS}"; IFS=$'\a'; export CHUCK_ARGS="${*}"; IFS="${old_IFS}" +imports=$(sed -n "s|^ *// *@import *|$(dirname $0)/|p" $step) + +separator=$(printf '\a') +for x; do + CHUCK_ARGS="${CHUCK_ARGS:+$CHUCK_ARGS$separator}$x" +done +export CHUCK_ARGS -exec chuck --caution-to-the-wind --silent --chugin:"$regex_chugin" ${imports} $(dirname $-1)/${STEP:-stepA_mal}.ck +exec chuck --caution-to-the-wind --silent --chugin:"$regex_chugin" \ + $imports $step diff --git a/impls/clojure/run b/impls/clojure/run index 5fe4d92804..1005d79779 100755 --- a/impls/clojure/run +++ b/impls/clojure/run @@ -1,8 +1,9 @@ #!/usr/bin/env bash -export PATH=$PATH:$(dirname $0)/node_modules/.bin +export PATH="$PATH:$(dirname $0)/node_modules/.bin" STEP=${STEP:-stepA_mal} -if [ "${clojure_MODE}" = "cljs" ]; then - exec lumo -c $(dirname $0)/src -m mal.${STEP//_/-} "${@}" -else - exec java -jar $(dirname $0)/target/${STEP}.jar "${@}" -fi +case ${clojure_MODE:-clj} in + cljs) exec lumo -c $(dirname $0)/src -m mal.${STEP//_/-} "$@" ;; + clj) exec java -jar $(dirname $0)/target/$STEP.jar "$@" ;; +esac +echo "Invalid clojure_MODE: $clojure_MODE" +exit 1 diff --git a/impls/coffee/run b/impls/coffee/run index 84deffb471..72d7c2817d 100755 --- a/impls/coffee/run +++ b/impls/coffee/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec coffee $(dirname $0)/${STEP:-stepA_mal}.coffee "${@}" +exec coffee $(dirname $0)/${STEP:-stepA_mal}.coffee "$@" diff --git a/impls/common-lisp/run b/impls/common-lisp/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/common-lisp/run +++ b/impls/common-lisp/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/cpp/run b/impls/cpp/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/cpp/run +++ b/impls/cpp/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/crystal/run b/impls/crystal/run index a42a7e149d..3d36605e03 100755 --- a/impls/crystal/run +++ b/impls/crystal/run @@ -1,2 +1,2 @@ #!/bin/sh -exec $(dirname $0)/bin/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/bin/${STEP:-stepA_mal} "$@" diff --git a/impls/cs/run b/impls/cs/run index 5c5642646f..91beef2d69 100755 --- a/impls/cs/run +++ b/impls/cs/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec mono $(dirname $0)/${STEP:-stepA_mal}.exe ${RAW:+--raw} "${@}" +exec mono $(dirname $0)/${STEP:-stepA_mal}.exe ${RAW:+--raw} "$@" diff --git a/impls/d/run b/impls/d/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/d/run +++ b/impls/d/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/dart/run b/impls/dart/run index 6f3ab8bca3..948a2a45a7 100755 --- a/impls/dart/run +++ b/impls/dart/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec dart --checked $(dirname $0)/${STEP:-stepA_mal}.dart "${@}" +exec dart --checked $(dirname $0)/${STEP:-stepA_mal}.dart "$@" diff --git a/impls/elisp/run b/impls/elisp/run index cb0387403c..f14aebb10a 100755 --- a/impls/elisp/run +++ b/impls/elisp/run @@ -1,3 +1,5 @@ #!/bin/sh dir=$(dirname $0) -exec emacs -Q --batch -L $dir --eval "(setq text-quoting-style 'straight)" --load $dir/${STEP:-stepA_mal}.elc "${@}" +exec emacs -Q --batch -L $dir \ + --eval "(setq text-quoting-style 'straight)" \ + --load $dir/${STEP:-stepA_mal}.elc "$@" diff --git a/impls/elixir/run b/impls/elixir/run index bfd505014b..191a56a45e 100755 --- a/impls/elixir/run +++ b/impls/elixir/run @@ -1,3 +1,3 @@ #!/usr/bin/env bash cd $(dirname $0) -exec mix ${STEP:-stepA_mal} "${@}" +exec mix ${STEP:-stepA_mal} "$@" diff --git a/impls/elm/run b/impls/elm/run index d22e4fbeac..4cf42af657 100755 --- a/impls/elm/run +++ b/impls/elm/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec node $(dirname $0)/bootstrap.js ${STEP:-stepA_mal} "${@}" +exec node $(dirname $0)/bootstrap.js ${STEP:-stepA_mal} "$@" diff --git a/impls/erlang/run b/impls/erlang/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/erlang/run +++ b/impls/erlang/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/es6/run b/impls/es6/run index 54e8932d5c..b71faee4cd 100755 --- a/impls/es6/run +++ b/impls/es6/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.mjs "${@}" +exec node $(dirname $0)/${STEP:-stepA_mal}.mjs "$@" diff --git a/impls/factor/run b/impls/factor/run index bb6d41f1da..812e8c3c01 100755 --- a/impls/factor/run +++ b/impls/factor/run @@ -1,2 +1,3 @@ #!/usr/bin/env bash -exec factor $(dirname $0)/${STEP:-stepA_mal}/${STEP:-stepA_mal}.factor "${@}" +step=${STEP:-stepA_mal} +exec factor $(dirname $0)/$step/$step.factor "$@" diff --git a/impls/fennel/run b/impls/fennel/run index 5842447c37..904ff718f6 100755 --- a/impls/fennel/run +++ b/impls/fennel/run @@ -1,3 +1,3 @@ #!/usr/bin/env bash -exec fennel $(dirname $0)/${STEP:-stepA_mal}.fnl "${@}" +exec fennel $(dirname $0)/${STEP:-stepA_mal}.fnl "$@" diff --git a/impls/forth/run b/impls/forth/run index 0a45c57df5..9d9b6d77f1 100755 --- a/impls/forth/run +++ b/impls/forth/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec gforth $(dirname $0)/${STEP:-stepA_mal}.fs "${@}" +exec gforth $(dirname $0)/${STEP:-stepA_mal}.fs "$@" diff --git a/impls/fsharp/run b/impls/fsharp/run index 5c5642646f..91beef2d69 100755 --- a/impls/fsharp/run +++ b/impls/fsharp/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec mono $(dirname $0)/${STEP:-stepA_mal}.exe ${RAW:+--raw} "${@}" +exec mono $(dirname $0)/${STEP:-stepA_mal}.exe ${RAW:+--raw} "$@" diff --git a/impls/gnu-smalltalk/run b/impls/gnu-smalltalk/run index 740459af26..9e87a265dd 100755 --- a/impls/gnu-smalltalk/run +++ b/impls/gnu-smalltalk/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec gst -f $(dirname $0)/${STEP:-stepA_mal}.st "${@}" +exec gst -f $(dirname $0)/${STEP:-stepA_mal}.st "$@" diff --git a/impls/go/run b/impls/go/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/go/run +++ b/impls/go/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/groovy/run b/impls/groovy/run index b64ea39452..fff2753561 100755 --- a/impls/groovy/run +++ b/impls/groovy/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec groovy $(dirname $0)/${STEP:-stepA_mal}.groovy "${@}" +exec groovy $(dirname $0)/${STEP:-stepA_mal}.groovy "$@" diff --git a/impls/guile/run b/impls/guile/run index 6d9e58d123..0e133613f4 100755 --- a/impls/guile/run +++ b/impls/guile/run @@ -1,3 +1,3 @@ #!/usr/bin/env bash # XDG_CACHE_HOME is where guile stores the compiled files -XDG_CACHE_HOME=.cache/ exec guile -L $(dirname $0) $(dirname $0)/${STEP:-stepA_mal}.scm "${@}" +XDG_CACHE_HOME=.cache/ exec guile -L $(dirname $0) $(dirname $0)/${STEP:-stepA_mal}.scm "$@" diff --git a/impls/hare/run b/impls/hare/run index 373d352735..81319040b2 100755 --- a/impls/hare/run +++ b/impls/hare/run @@ -1,3 +1,3 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" \ No newline at end of file +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/haskell/run b/impls/haskell/run index 6efdc3de32..57693e8022 100755 --- a/impls/haskell/run +++ b/impls/haskell/run @@ -1,2 +1,2 @@ #!/bin/sh -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/haxe/run b/impls/haxe/run index 3bb679ae65..f94b1e557a 100755 --- a/impls/haxe/run +++ b/impls/haxe/run @@ -1,8 +1,8 @@ #!/usr/bin/env bash case ${haxe_MODE:-neko} in - neko) exec neko $(dirname $0)/${STEP:-stepA_mal}.n "${@}" ;; - python) exec python3 $(dirname $0)/${STEP:-stepA_mal}.py "${@}" ;; - js) exec node $(dirname $0)/${STEP:-stepA_mal}.js "${@}" ;; - cpp) exec $(dirname $0)/cpp/${STEP:-stepA_mal} "${@}" ;; - *) echo "Invalid haxe_MODE: ${haxe_MODE}"; exit 2 ;; + neko) exec neko $(dirname $0)/${STEP:-stepA_mal}.n "$@" ;; + python) exec python3 $(dirname $0)/${STEP:-stepA_mal}.py "$@" ;; + js) exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" ;; + cpp) exec $(dirname $0)/cpp/${STEP:-stepA_mal} "$@" ;; + *) echo "Invalid haxe_MODE: $haxe_MODE"; exit 2 ;; esac diff --git a/impls/hy/run b/impls/hy/run index 7f69c4e5d9..efe4b22686 100755 --- a/impls/hy/run +++ b/impls/hy/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec hy $(dirname $0)/${STEP:-stepA_mal}.hy "${@}" +exec hy $(dirname $0)/${STEP:-stepA_mal}.hy "$@" diff --git a/impls/janet/run b/impls/janet/run index f4782c8fae..e06e39a8d4 100755 --- a/impls/janet/run +++ b/impls/janet/run @@ -1,2 +1,2 @@ #!/bin/sh -exec janet $(dirname $0)/${STEP:-stepA_mal}.janet "${@}" +exec janet $(dirname $0)/${STEP:-stepA_mal}.janet "$@" diff --git a/impls/java/run b/impls/java/run index 670f45c4db..567e9f649c 100755 --- a/impls/java/run +++ b/impls/java/run @@ -1,9 +1,8 @@ -#!/usr/bin/env bash -args="" -if [ "$#" -gt 0 ]; then - args="-Dexec.args='$1'" - for a in "${@:2}"; do - args="$args '$a'" - done -fi -exec mvn -quiet -e exec:java -Dexec.mainClass="mal.${STEP:-stepA_mal}" ${args:+"$args"} +#!/bin/sh +set -Cefu +for a; do + args="${args:+$args }'$a'" +done +exec mvn -quiet -e exec:java \ + -Dexec.mainClass=mal.${STEP:-stepA_mal} \ + ${args:+"-Dexec.args=$args"} diff --git a/impls/js/run b/impls/js/run index 1148122a23..893cbb59c7 100755 --- a/impls/js/run +++ b/impls/js/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.js "${@}" +exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" diff --git a/impls/julia/run b/impls/julia/run index dd149451f1..5791967a12 100755 --- a/impls/julia/run +++ b/impls/julia/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec julia $(dirname $0)/${STEP:-stepA_mal}.jl "${@}" +exec julia $(dirname $0)/${STEP:-stepA_mal}.jl "$@" diff --git a/impls/kotlin/run b/impls/kotlin/run index c5a1f3c10f..0dce7b02a0 100755 --- a/impls/kotlin/run +++ b/impls/kotlin/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec java -jar $(dirname $0)/${STEP:-stepA_mal}.jar "${@}" +exec java -jar $(dirname $0)/${STEP:-stepA_mal}.jar "$@" diff --git a/impls/livescript/run b/impls/livescript/run index 1148122a23..893cbb59c7 100755 --- a/impls/livescript/run +++ b/impls/livescript/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.js "${@}" +exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" diff --git a/impls/logo/run b/impls/logo/run index f4a73d98c1..065ff2b5d5 100755 --- a/impls/logo/run +++ b/impls/logo/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec ucblogo $(dirname $0)/${STEP:-stepA_mal}.lg - "${@}" +exec ucblogo $(dirname $0)/${STEP:-stepA_mal}.lg - "$@" diff --git a/impls/lua/run b/impls/lua/run index a53fbc60ba..87847a41e6 100755 --- a/impls/lua/run +++ b/impls/lua/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec lua $(dirname $0)/${STEP:-stepA_mal}.lua "${@}" +exec lua $(dirname $0)/${STEP:-stepA_mal}.lua "$@" diff --git a/impls/make/run b/impls/make/run index 43b9344665..9a10a4e51d 100755 --- a/impls/make/run +++ b/impls/make/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec make --no-print-directory -f $(dirname $0)/${STEP:-stepA_mal}.mk "${@}" +exec make --no-print-directory -f $(dirname $0)/${STEP:-stepA_mal}.mk "$@" diff --git a/impls/mal/run b/impls/mal/run index 3bf6b5b09c..5b48bd55bb 100755 --- a/impls/mal/run +++ b/impls/mal/run @@ -1,9 +1,12 @@ #!/usr/bin/env bash MAL_FILE=../mal/${STEP:-stepA_mal}.mal export STEP=stepA_mal # force MAL_IMPL to use stepA -case ${MAL_IMPL} in -*-mal) - MAL_IMPL=${MAL_IMPL%%-mal} - MAL_FILE="../mal/stepA_mal.mal ${MAL_FILE}" ;; +impl=${MAL_IMPL:-js} +case $impl in + *-mal) + exec ../${impl%-mal}/run ../mal/stepA_mal.mal $MAL_FILE "$@" + ;; + *) + exec ../$impl/run $MAL_FILE "$@" + ;; esac -exec ./../${MAL_IMPL:-js}/run ${MAL_FILE} "${@}" diff --git a/impls/matlab/run b/impls/matlab/run index 332c5903de..6181b298e0 100755 --- a/impls/matlab/run +++ b/impls/matlab/run @@ -1,21 +1,19 @@ #!/bin/sh -args= for x; do - args="$args${args:+, }'$x'" + args="${args:+$args, }'$x'" done +prompt="${STEP:-stepA_mal}(${args:-});quit;" -case "$matlab_MODE" in +case ${matlab_MODE:-octave} in matlab) - options='-nodisplay -nosplash -nodesktop -nojvm -r' + exec matlab -nodisplay -nosplash -nodesktop -nojvm -r "$prompt" ;; octave) - options='-q --no-gui --no-history --eval' + exec octave -q --no-gui --no-history --eval "$prompt" ;; *) echo "Bad matlab_MODE: $matlab_MODE" exit 1 ;; esac - -exec $matlab_MODE $options "${STEP:-stepA_mal}($args);quit;" diff --git a/impls/miniMAL/run b/impls/miniMAL/run index 5fe9482d6e..df66bc329c 100755 --- a/impls/miniMAL/run +++ b/impls/miniMAL/run @@ -1,3 +1,3 @@ #!/usr/bin/env bash cd $(dirname $0) -exec miniMAL ./${STEP:-stepA_mal}.json "${@}" +exec miniMAL ./${STEP:-stepA_mal}.json "$@" diff --git a/impls/nasm/run b/impls/nasm/run index 016cc72d79..7933a7939f 100755 --- a/impls/nasm/run +++ b/impls/nasm/run @@ -1,3 +1,3 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/nim/run b/impls/nim/run index 6efdc3de32..57693e8022 100755 --- a/impls/nim/run +++ b/impls/nim/run @@ -1,2 +1,2 @@ #!/bin/sh -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/objc/run b/impls/objc/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/objc/run +++ b/impls/objc/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/objpascal/run b/impls/objpascal/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/objpascal/run +++ b/impls/objpascal/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/ocaml/run b/impls/ocaml/run index 6efdc3de32..57693e8022 100755 --- a/impls/ocaml/run +++ b/impls/ocaml/run @@ -1,2 +1,2 @@ #!/bin/sh -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/perl6/run b/impls/perl6/run index 80cb92b34b..8a58ac8a01 100755 --- a/impls/perl6/run +++ b/impls/perl6/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec perl6 $(dirname $0)/${STEP:-stepA_mal}.pl "${@}" +exec perl6 $(dirname $0)/${STEP:-stepA_mal}.pl "$@" diff --git a/impls/php/run b/impls/php/run index daf97f93c0..ef22b62eb3 100755 --- a/impls/php/run +++ b/impls/php/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec php $(dirname $0)/${STEP:-stepA_mal}.php "${@}" +exec php $(dirname $0)/${STEP:-stepA_mal}.php "$@" diff --git a/impls/picolisp/run b/impls/picolisp/run index a7f77da3fd..a9f757b2d9 100755 --- a/impls/picolisp/run +++ b/impls/picolisp/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec pil $(dirname $0)/${STEP:-stepA_mal}.l - "${@}" +exec pil $(dirname $0)/${STEP:-stepA_mal}.l - "$@" diff --git a/impls/pike/run b/impls/pike/run index 1281d967de..8b74b25265 100755 --- a/impls/pike/run +++ b/impls/pike/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec pike $(dirname $0)/${STEP:-stepA_mal}.pike "${@}" +exec pike $(dirname $0)/${STEP:-stepA_mal}.pike "$@" diff --git a/impls/powershell/run b/impls/powershell/run index 7adde42817..0927bcdcea 100755 --- a/impls/powershell/run +++ b/impls/powershell/run @@ -1,2 +1,2 @@ #!/bin/sh -exec powershell $(dirname $0)/${STEP:-stepA_mal}.ps1 "${@}" +exec powershell $(dirname $0)/${STEP:-stepA_mal}.ps1 "$@" diff --git a/impls/prolog/run b/impls/prolog/run index 6a9b5f1fe4..908d180b8b 100755 --- a/impls/prolog/run +++ b/impls/prolog/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec swipl $(dirname $0)/${STEP:-stepA_mal}.pl "${@}" +exec swipl $(dirname $0)/${STEP:-stepA_mal}.pl "$@" diff --git a/impls/ps/run b/impls/ps/run index a961d13c7f..dde80e1f66 100755 --- a/impls/ps/run +++ b/impls/ps/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec gs -q -I$(dirname $0) -dNOSAFER -dNODISPLAY -- $(dirname $0)/${STEP:-stepA_mal}.ps "${@}" +exec gs -q -I$(dirname $0) -dNOSAFER -dNODISPLAY -- $(dirname $0)/${STEP:-stepA_mal}.ps "$@" diff --git a/impls/purs/run b/impls/purs/run index 510f226881..893cbb59c7 100755 --- a/impls/purs/run +++ b/impls/purs/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.js "${@}" \ No newline at end of file +exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" diff --git a/impls/python2/run b/impls/python2/run index 095e1963d0..2c41196a13 100755 --- a/impls/python2/run +++ b/impls/python2/run @@ -1,2 +1,2 @@ #!/bin/sh -exec python2 $(dirname $0)/${STEP:-stepA_mal}.py "${@}" +exec python2 $(dirname $0)/${STEP:-stepA_mal}.py "$@" diff --git a/impls/python3/run b/impls/python3/run index 1e7632cd57..9b7b01bfba 100755 --- a/impls/python3/run +++ b/impls/python3/run @@ -1,2 +1,2 @@ #!/bin/sh -exec python3 $(dirname $0)/${STEP:-stepA_mal}.py "${@}" +exec python3 $(dirname $0)/${STEP:-stepA_mal}.py "$@" diff --git a/impls/r/run b/impls/r/run index 916876f09d..9675392139 100755 --- a/impls/r/run +++ b/impls/r/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec Rscript $(dirname $0)/${STEP:-stepA_mal}.r "${@}" +exec Rscript $(dirname $0)/${STEP:-stepA_mal}.r "$@" diff --git a/impls/racket/run b/impls/racket/run index fa0719bdce..07cc20aa3f 100755 --- a/impls/racket/run +++ b/impls/racket/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec racket $(dirname $0)/${STEP:-stepA_mal}.rkt "${@}" +exec racket $(dirname $0)/${STEP:-stepA_mal}.rkt "$@" diff --git a/impls/rexx/run b/impls/rexx/run index b911329610..a38c60a0c6 100755 --- a/impls/rexx/run +++ b/impls/rexx/run @@ -1,2 +1,2 @@ #!/bin/sh -exec rexx -a $(dirname $0)/${STEP:-stepA_mal}.rexxpp "${@}" +exec rexx -a $(dirname $0)/${STEP:-stepA_mal}.rexxpp "$@" diff --git a/impls/rpython/run b/impls/rpython/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/rpython/run +++ b/impls/rpython/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/ruby.2/run b/impls/ruby.2/run index 980db0d659..c1acbcbbfb 100755 --- a/impls/ruby.2/run +++ b/impls/ruby.2/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec ruby $(dirname $0)/${STEP:-stepA_mal}.rb "${@}" +exec ruby $(dirname $0)/${STEP:-stepA_mal}.rb "$@" diff --git a/impls/ruby/run b/impls/ruby/run index 980db0d659..c1acbcbbfb 100755 --- a/impls/ruby/run +++ b/impls/ruby/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec ruby $(dirname $0)/${STEP:-stepA_mal}.rb "${@}" +exec ruby $(dirname $0)/${STEP:-stepA_mal}.rb "$@" diff --git a/impls/rust/run b/impls/rust/run index d67524c747..a86855ad8d 100755 --- a/impls/rust/run +++ b/impls/rust/run @@ -1,2 +1,2 @@ #!/bin/sh -exec $(dirname $0)/target/release/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/target/release/${STEP:-stepA_mal} "$@" diff --git a/impls/scala/run b/impls/scala/run index eb06292ab5..aec8710d86 100755 --- a/impls/scala/run +++ b/impls/scala/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec java -classpath "$(dirname $0)/target/scala-2.11/mal.jar" "${STEP:-stepA_mal}" "$@" +exec java -classpath "$(dirname $0)/target/scala-2.11/mal.jar" ${STEP:-stepA_mal} "$@" diff --git a/impls/scheme/run b/impls/scheme/run index acef8c0753..72fda6bcc8 100755 --- a/impls/scheme/run +++ b/impls/scheme/run @@ -3,7 +3,7 @@ basedir=$(dirname $0) step=${STEP:-stepA_mal} case ${scheme_MODE:-chibi} in - chibi) exec chibi-scheme -I$basedir $basedir/$step.scm "${@}" ;; + chibi) exec chibi-scheme -I$basedir $basedir/$step.scm "$@" ;; kawa) if [ -e /usr/share/kawa/lib/kawa.jar ]; then kawa=/usr/share/kawa/lib/kawa.jar elif [ -e /usr/local/share/kawa/lib/kawa.jar ]; then @@ -12,9 +12,9 @@ case ${scheme_MODE:-chibi} in echo >&2 'Failed to find kawa.jar.' exit 1 fi - exec java -cp $kawa:$basedir/out $step "${@}" ;; - gauche) exec gosh -I$basedir $basedir/$step.scm "${@}" ;; - chicken) CHICKEN_REPOSITORY=$basedir/eggs exec $basedir/$step "${@}" ;; + exec java -cp $kawa:$basedir/out $step "$@" ;; + gauche) exec gosh -I$basedir $basedir/$step.scm "$@" ;; + chicken) CHICKEN_REPOSITORY=$basedir/eggs exec $basedir/$step "$@" ;; sagittarius) if command -v sash >/dev/null 2>&1; then sagittarius=sash elif command -v sagittarius >/dev/null 2>&1; then @@ -23,8 +23,8 @@ case ${scheme_MODE:-chibi} in echo >&2 'Failed to find sash or sagittarius.' exit 1 fi - exec $sagittarius -n -L$basedir $basedir/$step.scm "${@}" ;; - cyclone) exec $basedir/$step "${@}" ;; - foment) exec foment $basedir/$step.scm "${@}" ;; - *) echo "Invalid scheme_MODE: ${scheme_MODE}"; exit 2 ;; + exec $sagittarius -n -L$basedir $basedir/$step.scm "$@" ;; + cyclone) exec $basedir/$step "$@" ;; + foment) exec foment $basedir/$step.scm "$@" ;; + *) echo "Invalid scheme_MODE: $scheme_MODE"; exit 2 ;; esac diff --git a/impls/skew/run b/impls/skew/run index 1148122a23..893cbb59c7 100755 --- a/impls/skew/run +++ b/impls/skew/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.js "${@}" +exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" diff --git a/impls/sml/run b/impls/sml/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/sml/run +++ b/impls/sml/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/swift3/run b/impls/swift3/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/swift3/run +++ b/impls/swift3/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/swift4/run b/impls/swift4/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/swift4/run +++ b/impls/swift4/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/swift6/run b/impls/swift6/run index 8003dd69cb..8a2cee3d04 100755 --- a/impls/swift6/run +++ b/impls/swift6/run @@ -1,2 +1,2 @@ #!/bin/sh -exec $(dirname $0)/.build/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/.build/${STEP:-stepA_mal} "$@" diff --git a/impls/tcl/run b/impls/tcl/run index 700b5291b0..443068da76 100755 --- a/impls/tcl/run +++ b/impls/tcl/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec tclsh $(dirname $0)/${STEP:-stepA_mal}.tcl ${RAW:+--raw} "${@}" +exec tclsh $(dirname $0)/${STEP:-stepA_mal}.tcl ${RAW:+--raw} "$@" diff --git a/impls/ts/run b/impls/ts/run index 1148122a23..893cbb59c7 100755 --- a/impls/ts/run +++ b/impls/ts/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.js "${@}" +exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" diff --git a/impls/vala/run b/impls/vala/run index c66c2b81dc..6e11defbfb 100755 --- a/impls/vala/run +++ b/impls/vala/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/${STEP:-stepA_mal} "$@" diff --git a/impls/vb/run b/impls/vb/run index 5c5642646f..91beef2d69 100755 --- a/impls/vb/run +++ b/impls/vb/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec mono $(dirname $0)/${STEP:-stepA_mal}.exe ${RAW:+--raw} "${@}" +exec mono $(dirname $0)/${STEP:-stepA_mal}.exe ${RAW:+--raw} "$@" diff --git a/impls/vbs/run b/impls/vbs/run index 3c1aed2dd3..ec0a7aba16 100644 --- a/impls/vbs/run +++ b/impls/vbs/run @@ -1,4 +1,4 @@ #!/usr/bin/env bash MAL_VBS_IMPL_NO_STDERR=1 MAL_VBS_IMPL_ECHO_STDIN=1 \ WSLENV=MAL_VBS_IMPL_NO_STDERR/w:MAL_VBS_IMPL_ECHO_STDIN/w \ -cscript.exe -nologo "`wslpath -w "$(dirname $0)/${STEP:-stepA_mal}.vbs"`" "${@}" \ No newline at end of file +exec cscript.exe -nologo "`wslpath -w "$(dirname $0)/${STEP:-stepA_mal}.vbs"`" "$@" diff --git a/impls/vhdl/run b/impls/vhdl/run index 0d3a5d40c4..2e60d28742 100755 --- a/impls/vhdl/run +++ b/impls/vhdl/run @@ -7,7 +7,7 @@ bin="$(dirname $0)/${STEP:-stepA_mal}" -for arg in "$@" ; do +for arg; do echo "$arg" done > vhdl_argv.tmp diff --git a/impls/wasm/run b/impls/wasm/run index 29c44131c2..764b5d920f 100755 --- a/impls/wasm/run +++ b/impls/wasm/run @@ -1,18 +1,17 @@ #!/usr/bin/env bash -STEP=${STEP:-stepA_mal} -case "${wasm_MODE}" in +case ${wasm_MODE:-js} in wasmtime) - exec wasmtime --dir=./ --dir=../ --dir=/ $(dirname $0)/${STEP:-stepA_mal}.wasm "${@}" ;; + exec wasmtime --dir=./ --dir=../ --dir=/ $(dirname $0)/${STEP:-stepA_mal}.wasm "$@" ;; wasmer) - exec wasmer run --dir=./ --dir=../ --dir=/ $(dirname $0)/${STEP:-stepA_mal}.wasm -- "${@}" ;; + exec wasmer run --dir=./ --dir=../ --dir=/ $(dirname $0)/${STEP:-stepA_mal}.wasm -- "$@" ;; warpy) - exec warpy --argv --memory-pages 256 $(dirname $0)/${STEP:-stepA_mal}.wasm "${@}" ;; + exec warpy --argv --memory-pages 256 $(dirname $0)/${STEP:-stepA_mal}.wasm "$@" ;; wax) - exec wax $(dirname $0)/${STEP:-stepA_mal}.wasm "${@}" ;; + exec wax $(dirname $0)/${STEP:-stepA_mal}.wasm "$@" ;; wace_libc) - exec wace $(dirname $0)/${STEP:-stepA_mal}.wasm "${@}" ;; + exec wace $(dirname $0)/${STEP:-stepA_mal}.wasm "$@" ;; wace_fooboot) echo >&2 "wace_fooboot mode not yet supported" ;; node|js|*) - exec node run.js $(dirname $0)/${STEP:-stepA_mal}.wasm "${@}" ;; + exec node run.js $(dirname $0)/${STEP:-stepA_mal}.wasm "$@" ;; esac diff --git a/impls/wren/run b/impls/wren/run index 8c269bf55a..f8cfe496d9 100755 --- a/impls/wren/run +++ b/impls/wren/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec wren $(dirname $0)/${STEP:-stepA_mal}.wren "${@}" +exec wren $(dirname $0)/${STEP:-stepA_mal}.wren "$@" diff --git a/impls/yorick/run b/impls/yorick/run index 78b865fca2..4f35ebe814 100755 --- a/impls/yorick/run +++ b/impls/yorick/run @@ -1,3 +1,3 @@ #!/usr/bin/env bash export YORICK_MAL_PATH="$(dirname $0)" -exec yorick -batch "$YORICK_MAL_PATH/${STEP:-stepA_mal}.i" "${@}" +exec yorick -batch "$YORICK_MAL_PATH/${STEP:-stepA_mal}.i" "$@" diff --git a/impls/zig/run b/impls/zig/run index 35613af46a..9b1b3df961 100755 --- a/impls/zig/run +++ b/impls/zig/run @@ -1,2 +1,2 @@ #!/bin/sh -exec $(dirname $0)/zig-out/bin/${STEP:-stepA_mal} "${@}" +exec $(dirname $0)/zig-out/bin/${STEP:-stepA_mal} "$@" From d2d001f857d81320e15e9c6ae2f6ed2f6e3ea2c2 Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Sat, 18 Apr 2026 18:34:29 +0200 Subject: [PATCH 10/10] Make explicit that each run script is executed in its own directory The convention was already applied de facto: * {latex3,scala}/run start by changing their working directory, so relative paths in command line arguments must be relative to the implementation directory. * bbc-basic: contains '-path ../bbc-basic', so it assumes that it is executed in an implementation directory (even if not necessary its own). * impls/matlab/run already seems to assume that is is executed in its directory. It also fixes the execution of $path_with_spaces/impls/vimscript/run. Take the opportunity to change most shebangs from '/usr/bin/env bash' to 'bin/sh' because the latter is more portable, and more efficient when both actually differ. Also trigger all optional shell errors. --- impls/ada.2/run | 3 ++- impls/ada/run | 5 +++-- impls/awk/run | 5 +++-- impls/bash/run | 5 +++-- impls/basic/run | 6 +++++- impls/bbc-basic/run | 5 +++-- impls/c.2/run | 3 ++- impls/c/run | 5 +++-- impls/chuck/run | 8 +++++--- impls/clojure/run | 9 +++++---- impls/coffee/run | 5 +++-- impls/common-lisp/run | 5 +++-- impls/cpp/run | 5 +++-- impls/crystal/run | 3 ++- impls/cs/run | 5 +++-- impls/d/run | 5 +++-- impls/dart/run | 5 +++-- impls/elisp/run | 6 +++--- impls/elixir/run | 4 ++-- impls/elm/run | 5 +++-- impls/erlang/run | 5 +++-- impls/es6/run | 5 +++-- impls/factor/run | 5 +++-- impls/fantom/run | 5 +++-- impls/fennel/run | 6 +++--- impls/forth/run | 5 +++-- impls/fsharp/run | 5 +++-- impls/gnu-smalltalk/run | 5 +++-- impls/go/run | 5 +++-- impls/groovy/run | 5 +++-- impls/guile/run | 5 +++-- impls/hare/run | 6 +++--- impls/haskell/run | 3 ++- impls/haxe/run | 11 ++++++----- impls/hy/run | 5 +++-- impls/io/run | 6 +++--- impls/janet/run | 3 ++- impls/java-truffle/run | 3 ++- impls/js/run | 5 +++-- impls/julia/run | 5 +++-- impls/kotlin/run | 5 +++-- impls/latex3/run | 1 - impls/livescript/run | 5 +++-- impls/logo/run | 5 +++-- impls/lua/run | 5 +++-- impls/make/run | 5 +++-- impls/mal/run | 9 ++++++--- impls/matlab/run | 1 + impls/miniMAL/run | 6 +++--- impls/nasm/run | 6 +++--- impls/nim/run | 3 ++- impls/objc/run | 5 +++-- impls/objpascal/run | 5 +++-- impls/ocaml/run | 3 ++- impls/perl/run | 5 +++-- impls/perl6/run | 5 +++-- impls/php/run | 5 +++-- impls/php/tests/stepA_mal.mal | 2 +- impls/picolisp/run | 5 +++-- impls/pike/run | 5 +++-- impls/powershell/run | 3 ++- impls/prolog/run | 5 +++-- impls/ps/run | 5 +++-- impls/purs/run | 7 ++++++- impls/python2/run | 3 ++- impls/python3/run | 3 ++- impls/r/run | 5 +++-- impls/racket/run | 5 +++-- impls/rexx/run | 3 ++- impls/rpython/run | 5 +++-- impls/ruby.2/run | 5 +++-- impls/ruby/run | 5 +++-- impls/rust/run | 3 ++- impls/scala/run | 5 +++-- impls/scheme/run | 18 +++++++++--------- impls/skew/run | 5 +++-- impls/sml/run | 5 +++-- impls/swift3/run | 5 +++-- impls/swift4/run | 5 +++-- impls/swift6/run | 3 ++- impls/tcl/run | 5 +++-- impls/tests/run_argv_test.sh | 5 +++-- impls/ts/run | 5 +++-- impls/vala/run | 5 +++-- impls/vb/run | 5 +++-- impls/vbs/run | 5 +++-- impls/vhdl/run | 7 +++---- impls/vimscript/run | 8 ++++---- impls/wasm/run | 15 ++++++++------- impls/wren/run | 5 +++-- impls/yorick/run | 6 +++--- impls/yorick/step1_read_print.i | 1 - impls/yorick/step2_eval.i | 1 - impls/yorick/step3_env.i | 1 - impls/yorick/step4_if_fn_do.i | 1 - impls/yorick/step5_tco.i | 1 - impls/yorick/step6_file.i | 1 - impls/yorick/step7_quote.i | 1 - impls/yorick/step8_macros.i | 1 - impls/yorick/step9_try.i | 1 - impls/yorick/stepA_mal.i | 1 - impls/zig/run | 3 ++- process/guide.md | 23 ++++++++++++++++++----- 103 files changed, 298 insertions(+), 208 deletions(-) mode change 100644 => 100755 impls/vbs/run diff --git a/impls/ada.2/run b/impls/ada.2/run index 57693e8022..5ffd062744 100755 --- a/impls/ada.2/run +++ b/impls/ada.2/run @@ -1,2 +1,3 @@ #!/bin/sh -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/ada/run b/impls/ada/run index 6e11defbfb..5ffd062744 100755 --- a/impls/ada/run +++ b/impls/ada/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/awk/run b/impls/awk/run index c3cfdf6044..f0a9f48c35 100755 --- a/impls/awk/run +++ b/impls/awk/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec awk -f $(dirname $0)/${STEP:-stepA_mal}.awk "$@" +#!/bin/sh +set -Cefu +exec awk -f ${STEP:-stepA_mal}.awk "$@" diff --git a/impls/bash/run b/impls/bash/run index 29e282a6af..5ada142c2f 100755 --- a/impls/bash/run +++ b/impls/bash/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec bash $(dirname $0)/${STEP:-stepA_mal}.sh "$@" +#!/bin/sh +set -Cefu +exec bash ${STEP:-stepA_mal}.sh "$@" diff --git a/impls/basic/run b/impls/basic/run index 82b00367bb..84d80b9123 100755 --- a/impls/basic/run +++ b/impls/basic/run @@ -1,5 +1,9 @@ #!/usr/bin/env bash -cd $(dirname $0) + +# #!/bin/sh +# set -efu +# lets the step0 test for qbasic times out. + { printf '(def! -*ARGS*- (list' [ $# = 0 ] || printf ' "%s"' "$@" diff --git a/impls/bbc-basic/run b/impls/bbc-basic/run index 1e3b0523a0..8701b18cf7 100755 --- a/impls/bbc-basic/run +++ b/impls/bbc-basic/run @@ -1,3 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh +set -Cefu exec "${BRANDY:-sbrandy}" -size 1024k \ - -path ../bbc-basic -quit $(dirname $0)/${STEP:-stepA_mal}.bas "$@" + -quit ${STEP:-stepA_mal}.bas "$@" diff --git a/impls/c.2/run b/impls/c.2/run index 57693e8022..5ffd062744 100755 --- a/impls/c.2/run +++ b/impls/c.2/run @@ -1,2 +1,3 @@ #!/bin/sh -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/c/run b/impls/c/run index 6e11defbfb..5ffd062744 100755 --- a/impls/c/run +++ b/impls/c/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/chuck/run b/impls/chuck/run index 7f7e1e5d97..9375e4d69b 100755 --- a/impls/chuck/run +++ b/impls/chuck/run @@ -1,5 +1,6 @@ -#!/usr/bin/env bash -step=$(dirname $0)/${STEP:-stepA_mal}.ck +#!/bin/sh +set -Ceu +step=${STEP:-stepA_mal}.ck regex_chugin=${REGEX_CHUGIN:-/usr/local/lib/chuck/1.5.2.5/RegEx.chug} if [ ! -f "$regex_chugin" ]; then @@ -7,7 +8,8 @@ if [ ! -f "$regex_chugin" ]; then exit 1 fi -imports=$(sed -n "s|^ *// *@import *|$(dirname $0)/|p" $step) +# The globs will be expanded in the exec line. +imports=$(sed -n "s|^ *// *@import *||p" $step) separator=$(printf '\a') for x; do diff --git a/impls/clojure/run b/impls/clojure/run index 1005d79779..0c188c559a 100755 --- a/impls/clojure/run +++ b/impls/clojure/run @@ -1,9 +1,10 @@ -#!/usr/bin/env bash -export PATH="$PATH:$(dirname $0)/node_modules/.bin" +#!/bin/sh +set -Cefu +export PATH="$PATH:node_modules/.bin" STEP=${STEP:-stepA_mal} case ${clojure_MODE:-clj} in - cljs) exec lumo -c $(dirname $0)/src -m mal.${STEP//_/-} "$@" ;; - clj) exec java -jar $(dirname $0)/target/$STEP.jar "$@" ;; + cljs) exec lumo -c src -m mal.$(echo $STEP | tr _ -) "$@" ;; + clj) exec java -jar target/$STEP.jar "$@" ;; esac echo "Invalid clojure_MODE: $clojure_MODE" exit 1 diff --git a/impls/coffee/run b/impls/coffee/run index 72d7c2817d..58f481b9ec 100755 --- a/impls/coffee/run +++ b/impls/coffee/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec coffee $(dirname $0)/${STEP:-stepA_mal}.coffee "$@" +#!/bin/sh +set -Cefu +exec coffee ${STEP:-stepA_mal}.coffee "$@" diff --git a/impls/common-lisp/run b/impls/common-lisp/run index 6e11defbfb..5ffd062744 100755 --- a/impls/common-lisp/run +++ b/impls/common-lisp/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/cpp/run b/impls/cpp/run index 6e11defbfb..5ffd062744 100755 --- a/impls/cpp/run +++ b/impls/cpp/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/crystal/run b/impls/crystal/run index 3d36605e03..bf24a176db 100755 --- a/impls/crystal/run +++ b/impls/crystal/run @@ -1,2 +1,3 @@ #!/bin/sh -exec $(dirname $0)/bin/${STEP:-stepA_mal} "$@" +set -Cefu +exec bin/${STEP:-stepA_mal} "$@" diff --git a/impls/cs/run b/impls/cs/run index 91beef2d69..8ea6fdbea1 100755 --- a/impls/cs/run +++ b/impls/cs/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec mono $(dirname $0)/${STEP:-stepA_mal}.exe ${RAW:+--raw} "$@" +#!/bin/sh +set -Cefu +exec mono ${STEP:-stepA_mal}.exe ${RAW:+--raw} "$@" diff --git a/impls/d/run b/impls/d/run index 6e11defbfb..5ffd062744 100755 --- a/impls/d/run +++ b/impls/d/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/dart/run b/impls/dart/run index 948a2a45a7..d8320472de 100755 --- a/impls/dart/run +++ b/impls/dart/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec dart --checked $(dirname $0)/${STEP:-stepA_mal}.dart "$@" +#!/bin/sh +set -Cefu +exec dart --checked ${STEP:-stepA_mal}.dart "$@" diff --git a/impls/elisp/run b/impls/elisp/run index f14aebb10a..16aaeb34c5 100755 --- a/impls/elisp/run +++ b/impls/elisp/run @@ -1,5 +1,5 @@ #!/bin/sh -dir=$(dirname $0) -exec emacs -Q --batch -L $dir \ +set -Cefu +exec emacs -Q --batch -L . \ --eval "(setq text-quoting-style 'straight)" \ - --load $dir/${STEP:-stepA_mal}.elc "$@" + --load ${STEP:-stepA_mal}.elc "$@" diff --git a/impls/elixir/run b/impls/elixir/run index 191a56a45e..8c4f3f8eeb 100755 --- a/impls/elixir/run +++ b/impls/elixir/run @@ -1,3 +1,3 @@ -#!/usr/bin/env bash -cd $(dirname $0) +#!/bin/sh +set -Cefu exec mix ${STEP:-stepA_mal} "$@" diff --git a/impls/elm/run b/impls/elm/run index 4cf42af657..7235b16b18 100755 --- a/impls/elm/run +++ b/impls/elm/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec node $(dirname $0)/bootstrap.js ${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec node bootstrap.js ${STEP:-stepA_mal} "$@" diff --git a/impls/erlang/run b/impls/erlang/run index 6e11defbfb..5ffd062744 100755 --- a/impls/erlang/run +++ b/impls/erlang/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/es6/run b/impls/es6/run index b71faee4cd..1c8b71b919 100755 --- a/impls/es6/run +++ b/impls/es6/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.mjs "$@" +#!/bin/sh +set -Cefu +exec node ${STEP:-stepA_mal}.mjs "$@" diff --git a/impls/factor/run b/impls/factor/run index 812e8c3c01..b2e0210719 100755 --- a/impls/factor/run +++ b/impls/factor/run @@ -1,3 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh +set -Cefu step=${STEP:-stepA_mal} -exec factor $(dirname $0)/$step/$step.factor "$@" +exec factor $step/$step.factor "$@" diff --git a/impls/fantom/run b/impls/fantom/run index b0b70cf57b..72c94f7416 100755 --- a/impls/fantom/run +++ b/impls/fantom/run @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +#!/bin/sh +set -Cefu export FAN_ENV=util::PathEnv -export FAN_ENV_PATH="$(dirname $0)" +export FAN_ENV_PATH=. exec fan ${STEP:-stepA_mal} "$@" diff --git a/impls/fennel/run b/impls/fennel/run index 904ff718f6..12cbae82c3 100755 --- a/impls/fennel/run +++ b/impls/fennel/run @@ -1,3 +1,3 @@ -#!/usr/bin/env bash - -exec fennel $(dirname $0)/${STEP:-stepA_mal}.fnl "$@" +#!/bin/sh +set -Cefu +exec fennel ${STEP:-stepA_mal}.fnl "$@" diff --git a/impls/forth/run b/impls/forth/run index 9d9b6d77f1..3290045678 100755 --- a/impls/forth/run +++ b/impls/forth/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec gforth $(dirname $0)/${STEP:-stepA_mal}.fs "$@" +#!/bin/sh +set -Cefu +exec gforth ${STEP:-stepA_mal}.fs "$@" diff --git a/impls/fsharp/run b/impls/fsharp/run index 91beef2d69..8ea6fdbea1 100755 --- a/impls/fsharp/run +++ b/impls/fsharp/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec mono $(dirname $0)/${STEP:-stepA_mal}.exe ${RAW:+--raw} "$@" +#!/bin/sh +set -Cefu +exec mono ${STEP:-stepA_mal}.exe ${RAW:+--raw} "$@" diff --git a/impls/gnu-smalltalk/run b/impls/gnu-smalltalk/run index 9e87a265dd..746651207f 100755 --- a/impls/gnu-smalltalk/run +++ b/impls/gnu-smalltalk/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec gst -f $(dirname $0)/${STEP:-stepA_mal}.st "$@" +#!/bin/sh +set -Cefu +exec gst -f ${STEP:-stepA_mal}.st "$@" diff --git a/impls/go/run b/impls/go/run index 6e11defbfb..5ffd062744 100755 --- a/impls/go/run +++ b/impls/go/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/groovy/run b/impls/groovy/run index fff2753561..9733f7c8a5 100755 --- a/impls/groovy/run +++ b/impls/groovy/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec groovy $(dirname $0)/${STEP:-stepA_mal}.groovy "$@" +#!/bin/sh +set -Cefu +exec groovy ${STEP:-stepA_mal}.groovy "$@" diff --git a/impls/guile/run b/impls/guile/run index 0e133613f4..747d2c6932 100755 --- a/impls/guile/run +++ b/impls/guile/run @@ -1,3 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh +set -Cefu # XDG_CACHE_HOME is where guile stores the compiled files -XDG_CACHE_HOME=.cache/ exec guile -L $(dirname $0) $(dirname $0)/${STEP:-stepA_mal}.scm "$@" +XDG_CACHE_HOME=.cache/ exec guile -L . ${STEP:-stepA_mal}.scm "$@" diff --git a/impls/hare/run b/impls/hare/run index 81319040b2..5ffd062744 100755 --- a/impls/hare/run +++ b/impls/hare/run @@ -1,3 +1,3 @@ -#!/usr/bin/env bash - -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/haskell/run b/impls/haskell/run index 57693e8022..5ffd062744 100755 --- a/impls/haskell/run +++ b/impls/haskell/run @@ -1,2 +1,3 @@ #!/bin/sh -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/haxe/run b/impls/haxe/run index f94b1e557a..fdd0476b6a 100755 --- a/impls/haxe/run +++ b/impls/haxe/run @@ -1,8 +1,9 @@ -#!/usr/bin/env bash +#!/bin/sh +set -Cefu case ${haxe_MODE:-neko} in - neko) exec neko $(dirname $0)/${STEP:-stepA_mal}.n "$@" ;; - python) exec python3 $(dirname $0)/${STEP:-stepA_mal}.py "$@" ;; - js) exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" ;; - cpp) exec $(dirname $0)/cpp/${STEP:-stepA_mal} "$@" ;; + neko) exec neko ${STEP:-stepA_mal}.n "$@" ;; + python) exec python3 ${STEP:-stepA_mal}.py "$@" ;; + js) exec node ${STEP:-stepA_mal}.js "$@" ;; + cpp) exec cpp/${STEP:-stepA_mal} "$@" ;; *) echo "Invalid haxe_MODE: $haxe_MODE"; exit 2 ;; esac diff --git a/impls/hy/run b/impls/hy/run index efe4b22686..777d500345 100755 --- a/impls/hy/run +++ b/impls/hy/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec hy $(dirname $0)/${STEP:-stepA_mal}.hy "$@" +#!/bin/sh +set -Cefu +exec hy ${STEP:-stepA_mal}.hy "$@" diff --git a/impls/io/run b/impls/io/run index d49d10a227..6d84acab3b 100755 --- a/impls/io/run +++ b/impls/io/run @@ -1,3 +1,3 @@ -#!/usr/bin/env bash - -io $(dirname $0)/${STEP:-stepA_mal}.io "$@" +#!/bin/sh +set -Cefu +exec io ${STEP:-stepA_mal}.io "$@" diff --git a/impls/janet/run b/impls/janet/run index e06e39a8d4..59c0c1b628 100755 --- a/impls/janet/run +++ b/impls/janet/run @@ -1,2 +1,3 @@ #!/bin/sh -exec janet $(dirname $0)/${STEP:-stepA_mal}.janet "$@" +set -Cefu +exec janet ${STEP:-stepA_mal}.janet "$@" diff --git a/impls/java-truffle/run b/impls/java-truffle/run index c5ca27135f..5e6271cbe4 100755 --- a/impls/java-truffle/run +++ b/impls/java-truffle/run @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +#!/bin/sh +set -Cefu CP=$(gradle -q --console plain printClasspath) diff --git a/impls/js/run b/impls/js/run index 893cbb59c7..d1135e76d4 100755 --- a/impls/js/run +++ b/impls/js/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" +#!/bin/sh +set -Cefu +exec node ${STEP:-stepA_mal}.js "$@" diff --git a/impls/julia/run b/impls/julia/run index 5791967a12..3a08886fca 100755 --- a/impls/julia/run +++ b/impls/julia/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec julia $(dirname $0)/${STEP:-stepA_mal}.jl "$@" +#!/bin/sh +set -Cefu +exec julia ${STEP:-stepA_mal}.jl "$@" diff --git a/impls/kotlin/run b/impls/kotlin/run index 0dce7b02a0..f77cf44639 100755 --- a/impls/kotlin/run +++ b/impls/kotlin/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec java -jar $(dirname $0)/${STEP:-stepA_mal}.jar "$@" +#!/bin/sh +set -Cefu +exec java -jar ${STEP:-stepA_mal}.jar "$@" diff --git a/impls/latex3/run b/impls/latex3/run index 7a05291e20..c8965f8caf 100755 --- a/impls/latex3/run +++ b/impls/latex3/run @@ -2,7 +2,6 @@ set -Cefu # LaTeX creates temporary files in the current directory. -cd $(dirname $0) # There is no way to directly provide command line arguments to LaTeX, # use an intermediate file. diff --git a/impls/livescript/run b/impls/livescript/run index 893cbb59c7..d1135e76d4 100755 --- a/impls/livescript/run +++ b/impls/livescript/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" +#!/bin/sh +set -Cefu +exec node ${STEP:-stepA_mal}.js "$@" diff --git a/impls/logo/run b/impls/logo/run index 065ff2b5d5..422aa8fc40 100755 --- a/impls/logo/run +++ b/impls/logo/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec ucblogo $(dirname $0)/${STEP:-stepA_mal}.lg - "$@" +#!/bin/sh +set -Cefu +exec ucblogo ${STEP:-stepA_mal}.lg - "$@" diff --git a/impls/lua/run b/impls/lua/run index 87847a41e6..78595ba01f 100755 --- a/impls/lua/run +++ b/impls/lua/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec lua $(dirname $0)/${STEP:-stepA_mal}.lua "$@" +#!/bin/sh +set -Cefu +exec lua ${STEP:-stepA_mal}.lua "$@" diff --git a/impls/make/run b/impls/make/run index 9a10a4e51d..bfbcc4447e 100755 --- a/impls/make/run +++ b/impls/make/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec make --no-print-directory -f $(dirname $0)/${STEP:-stepA_mal}.mk "$@" +#!/bin/sh +set -Cefu +exec make --no-print-directory -f ${STEP:-stepA_mal}.mk "$@" diff --git a/impls/mal/run b/impls/mal/run index 5b48bd55bb..f9ac1907bc 100755 --- a/impls/mal/run +++ b/impls/mal/run @@ -1,12 +1,15 @@ -#!/usr/bin/env bash +#!/bin/sh +set -Cefu MAL_FILE=../mal/${STEP:-stepA_mal}.mal export STEP=stepA_mal # force MAL_IMPL to use stepA impl=${MAL_IMPL:-js} case $impl in *-mal) - exec ../${impl%-mal}/run ../mal/stepA_mal.mal $MAL_FILE "$@" + cd ../${impl%-mal} + exec ./run ../mal/stepA_mal.mal $MAL_FILE "$@" ;; *) - exec ../$impl/run $MAL_FILE "$@" + cd ../$impl + exec ./run $MAL_FILE "$@" ;; esac diff --git a/impls/matlab/run b/impls/matlab/run index 6181b298e0..34d12fa2ba 100755 --- a/impls/matlab/run +++ b/impls/matlab/run @@ -1,4 +1,5 @@ #!/bin/sh +set -Cefu for x; do args="${args:+$args, }'$x'" diff --git a/impls/miniMAL/run b/impls/miniMAL/run index df66bc329c..824b708851 100755 --- a/impls/miniMAL/run +++ b/impls/miniMAL/run @@ -1,3 +1,3 @@ -#!/usr/bin/env bash -cd $(dirname $0) -exec miniMAL ./${STEP:-stepA_mal}.json "$@" +#!/bin/sh +set -Cefu +exec miniMAL ${STEP:-stepA_mal}.json "$@" diff --git a/impls/nasm/run b/impls/nasm/run index 7933a7939f..5ffd062744 100755 --- a/impls/nasm/run +++ b/impls/nasm/run @@ -1,3 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" - +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/nim/run b/impls/nim/run index 57693e8022..5ffd062744 100755 --- a/impls/nim/run +++ b/impls/nim/run @@ -1,2 +1,3 @@ #!/bin/sh -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/objc/run b/impls/objc/run index 6e11defbfb..5ffd062744 100755 --- a/impls/objc/run +++ b/impls/objc/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/objpascal/run b/impls/objpascal/run index 6e11defbfb..5ffd062744 100755 --- a/impls/objpascal/run +++ b/impls/objpascal/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/ocaml/run b/impls/ocaml/run index 57693e8022..5ffd062744 100755 --- a/impls/ocaml/run +++ b/impls/ocaml/run @@ -1,2 +1,3 @@ #!/bin/sh -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/perl/run b/impls/perl/run index a388a0c3ce..88118dc06b 100755 --- a/impls/perl/run +++ b/impls/perl/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec perl $(dirname $0)/${STEP:-stepA_mal}.pl ${RAW:+--raw} "$@" +#!/bin/sh +set -Cefu +exec perl ${STEP:-stepA_mal}.pl ${RAW:+--raw} "$@" diff --git a/impls/perl6/run b/impls/perl6/run index 8a58ac8a01..8d8e369eed 100755 --- a/impls/perl6/run +++ b/impls/perl6/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec perl6 $(dirname $0)/${STEP:-stepA_mal}.pl "$@" +#!/bin/sh +set -Cefu +exec perl6 ${STEP:-stepA_mal}.pl "$@" diff --git a/impls/php/run b/impls/php/run index ef22b62eb3..d2f262bc2b 100755 --- a/impls/php/run +++ b/impls/php/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec php $(dirname $0)/${STEP:-stepA_mal}.php "$@" +#!/bin/sh +set -Cefu +exec php ${STEP:-stepA_mal}.php "$@" diff --git a/impls/php/tests/stepA_mal.mal b/impls/php/tests/stepA_mal.mal index de459cdbcf..3a873c0440 100644 --- a/impls/php/tests/stepA_mal.mal +++ b/impls/php/tests/stepA_mal.mal @@ -37,7 +37,7 @@ ;; testing superglobal variable access (get php/_SERVER "PHP_SELF") -;=>"../php/stepA_mal.php" +;=>"stepA_mal.php" ;; testing PHP constants access diff --git a/impls/picolisp/run b/impls/picolisp/run index a9f757b2d9..7e5ffa8b30 100755 --- a/impls/picolisp/run +++ b/impls/picolisp/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec pil $(dirname $0)/${STEP:-stepA_mal}.l - "$@" +#!/bin/sh +set -Cefu +exec pil ${STEP:-stepA_mal}.l - "$@" diff --git a/impls/pike/run b/impls/pike/run index 8b74b25265..bb8b2b35ee 100755 --- a/impls/pike/run +++ b/impls/pike/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec pike $(dirname $0)/${STEP:-stepA_mal}.pike "$@" +#!/bin/sh +set -Cefu +exec pike ${STEP:-stepA_mal}.pike "$@" diff --git a/impls/powershell/run b/impls/powershell/run index 0927bcdcea..4687eac282 100755 --- a/impls/powershell/run +++ b/impls/powershell/run @@ -1,2 +1,3 @@ #!/bin/sh -exec powershell $(dirname $0)/${STEP:-stepA_mal}.ps1 "$@" +set -Cefu +exec powershell ./${STEP:-stepA_mal}.ps1 "$@" diff --git a/impls/prolog/run b/impls/prolog/run index 908d180b8b..fa8ca18ff3 100755 --- a/impls/prolog/run +++ b/impls/prolog/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec swipl $(dirname $0)/${STEP:-stepA_mal}.pl "$@" +#!/bin/sh +set -Cefu +exec swipl ${STEP:-stepA_mal}.pl "$@" diff --git a/impls/ps/run b/impls/ps/run index dde80e1f66..2887396e2e 100755 --- a/impls/ps/run +++ b/impls/ps/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec gs -q -I$(dirname $0) -dNOSAFER -dNODISPLAY -- $(dirname $0)/${STEP:-stepA_mal}.ps "$@" +#!/bin/sh +set -Cefu +exec gs -q -I. -dNOSAFER -dNODISPLAY -- ${STEP:-stepA_mal}.ps "$@" diff --git a/impls/purs/run b/impls/purs/run index 893cbb59c7..1b12317b7e 100755 --- a/impls/purs/run +++ b/impls/purs/run @@ -1,2 +1,7 @@ #!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" + +# #!/bin/sh +# set -efu +# breaks the self hosted test for step0 with an IO exception. + +exec node ${STEP:-stepA_mal}.js "$@" diff --git a/impls/python2/run b/impls/python2/run index 2c41196a13..69c9dc7644 100755 --- a/impls/python2/run +++ b/impls/python2/run @@ -1,2 +1,3 @@ #!/bin/sh -exec python2 $(dirname $0)/${STEP:-stepA_mal}.py "$@" +set -Cefu +exec python2 ${STEP:-stepA_mal}.py "$@" diff --git a/impls/python3/run b/impls/python3/run index 9b7b01bfba..e57219fcae 100755 --- a/impls/python3/run +++ b/impls/python3/run @@ -1,2 +1,3 @@ #!/bin/sh -exec python3 $(dirname $0)/${STEP:-stepA_mal}.py "$@" +set -Cefu +exec python3 ${STEP:-stepA_mal}.py "$@" diff --git a/impls/r/run b/impls/r/run index 9675392139..3d8166379b 100755 --- a/impls/r/run +++ b/impls/r/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec Rscript $(dirname $0)/${STEP:-stepA_mal}.r "$@" +#!/bin/sh +set -Cefu +exec Rscript ${STEP:-stepA_mal}.r "$@" diff --git a/impls/racket/run b/impls/racket/run index 07cc20aa3f..72658cfba8 100755 --- a/impls/racket/run +++ b/impls/racket/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec racket $(dirname $0)/${STEP:-stepA_mal}.rkt "$@" +#!/bin/sh +set -Cefu +exec racket ${STEP:-stepA_mal}.rkt "$@" diff --git a/impls/rexx/run b/impls/rexx/run index a38c60a0c6..307605eaae 100755 --- a/impls/rexx/run +++ b/impls/rexx/run @@ -1,2 +1,3 @@ #!/bin/sh -exec rexx -a $(dirname $0)/${STEP:-stepA_mal}.rexxpp "$@" +set -Cefu +exec rexx -a ${STEP:-stepA_mal}.rexxpp "$@" diff --git a/impls/rpython/run b/impls/rpython/run index 6e11defbfb..5ffd062744 100755 --- a/impls/rpython/run +++ b/impls/rpython/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/ruby.2/run b/impls/ruby.2/run index c1acbcbbfb..af3ef3ab4e 100755 --- a/impls/ruby.2/run +++ b/impls/ruby.2/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec ruby $(dirname $0)/${STEP:-stepA_mal}.rb "$@" +#!/bin/sh +set -Cefu +exec ruby ${STEP:-stepA_mal}.rb "$@" diff --git a/impls/ruby/run b/impls/ruby/run index c1acbcbbfb..af3ef3ab4e 100755 --- a/impls/ruby/run +++ b/impls/ruby/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec ruby $(dirname $0)/${STEP:-stepA_mal}.rb "$@" +#!/bin/sh +set -Cefu +exec ruby ${STEP:-stepA_mal}.rb "$@" diff --git a/impls/rust/run b/impls/rust/run index a86855ad8d..46e9ab2269 100755 --- a/impls/rust/run +++ b/impls/rust/run @@ -1,2 +1,3 @@ #!/bin/sh -exec $(dirname $0)/target/release/${STEP:-stepA_mal} "$@" +set -Cefu +exec target/release/${STEP:-stepA_mal} "$@" diff --git a/impls/scala/run b/impls/scala/run index aec8710d86..57b25b1e65 100755 --- a/impls/scala/run +++ b/impls/scala/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec java -classpath "$(dirname $0)/target/scala-2.11/mal.jar" ${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec java -classpath target/scala-2.11/mal.jar ${STEP:-stepA_mal} "$@" diff --git a/impls/scheme/run b/impls/scheme/run index 72fda6bcc8..ab089dc050 100755 --- a/impls/scheme/run +++ b/impls/scheme/run @@ -1,9 +1,9 @@ -#!/usr/bin/env bash -basedir=$(dirname $0) +#!/bin/sh +set -Cefu step=${STEP:-stepA_mal} case ${scheme_MODE:-chibi} in - chibi) exec chibi-scheme -I$basedir $basedir/$step.scm "$@" ;; + chibi) exec chibi-scheme $step.scm "$@" ;; kawa) if [ -e /usr/share/kawa/lib/kawa.jar ]; then kawa=/usr/share/kawa/lib/kawa.jar elif [ -e /usr/local/share/kawa/lib/kawa.jar ]; then @@ -12,9 +12,9 @@ case ${scheme_MODE:-chibi} in echo >&2 'Failed to find kawa.jar.' exit 1 fi - exec java -cp $kawa:$basedir/out $step "$@" ;; - gauche) exec gosh -I$basedir $basedir/$step.scm "$@" ;; - chicken) CHICKEN_REPOSITORY=$basedir/eggs exec $basedir/$step "$@" ;; + exec java -cp $kawa:out $step "$@" ;; + gauche) exec gosh -I. $step.scm "$@" ;; + chicken) CHICKEN_REPOSITORY=eggs exec ./$step "$@" ;; sagittarius) if command -v sash >/dev/null 2>&1; then sagittarius=sash elif command -v sagittarius >/dev/null 2>&1; then @@ -23,8 +23,8 @@ case ${scheme_MODE:-chibi} in echo >&2 'Failed to find sash or sagittarius.' exit 1 fi - exec $sagittarius -n -L$basedir $basedir/$step.scm "$@" ;; - cyclone) exec $basedir/$step "$@" ;; - foment) exec foment $basedir/$step.scm "$@" ;; + exec $sagittarius -n -L. $step.scm "$@" ;; + cyclone) exec ./$step "$@" ;; + foment) exec foment $step.scm "$@" ;; *) echo "Invalid scheme_MODE: $scheme_MODE"; exit 2 ;; esac diff --git a/impls/skew/run b/impls/skew/run index 893cbb59c7..d1135e76d4 100755 --- a/impls/skew/run +++ b/impls/skew/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" +#!/bin/sh +set -Cefu +exec node ${STEP:-stepA_mal}.js "$@" diff --git a/impls/sml/run b/impls/sml/run index 6e11defbfb..5ffd062744 100755 --- a/impls/sml/run +++ b/impls/sml/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/swift3/run b/impls/swift3/run index 6e11defbfb..5ffd062744 100755 --- a/impls/swift3/run +++ b/impls/swift3/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/swift4/run b/impls/swift4/run index 6e11defbfb..5ffd062744 100755 --- a/impls/swift4/run +++ b/impls/swift4/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/swift6/run b/impls/swift6/run index 8a2cee3d04..5163410dfe 100755 --- a/impls/swift6/run +++ b/impls/swift6/run @@ -1,2 +1,3 @@ #!/bin/sh -exec $(dirname $0)/.build/${STEP:-stepA_mal} "$@" +set -Cefu +exec .build/${STEP:-stepA_mal} "$@" diff --git a/impls/tcl/run b/impls/tcl/run index 443068da76..be3858ef90 100755 --- a/impls/tcl/run +++ b/impls/tcl/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec tclsh $(dirname $0)/${STEP:-stepA_mal}.tcl ${RAW:+--raw} "$@" +#!/bin/sh +set -Cefu +exec tclsh ${STEP:-stepA_mal}.tcl ${RAW:+--raw} "$@" diff --git a/impls/tests/run_argv_test.sh b/impls/tests/run_argv_test.sh index e3682e4f9f..25859019ef 100755 --- a/impls/tests/run_argv_test.sh +++ b/impls/tests/run_argv_test.sh @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +#!/bin/sh +set -Cefu # # Usage: run_argv_test.sh @@ -21,7 +22,7 @@ if [ -z "$1" ] ; then exit 1 fi -root="$(dirname $0)" +root=../tests out="$( $@ $root/print_argv.mal aaa bbb ccc | tr -d '\r' )" assert_equal '("aaa" "bbb" "ccc")' "$out" diff --git a/impls/ts/run b/impls/ts/run index 893cbb59c7..d1135e76d4 100755 --- a/impls/ts/run +++ b/impls/ts/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec node $(dirname $0)/${STEP:-stepA_mal}.js "$@" +#!/bin/sh +set -Cefu +exec node ${STEP:-stepA_mal}.js "$@" diff --git a/impls/vala/run b/impls/vala/run index 6e11defbfb..5ffd062744 100755 --- a/impls/vala/run +++ b/impls/vala/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "$@" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" diff --git a/impls/vb/run b/impls/vb/run index 91beef2d69..8ea6fdbea1 100755 --- a/impls/vb/run +++ b/impls/vb/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec mono $(dirname $0)/${STEP:-stepA_mal}.exe ${RAW:+--raw} "$@" +#!/bin/sh +set -Cefu +exec mono ${STEP:-stepA_mal}.exe ${RAW:+--raw} "$@" diff --git a/impls/vbs/run b/impls/vbs/run old mode 100644 new mode 100755 index ec0a7aba16..d225cb3a44 --- a/impls/vbs/run +++ b/impls/vbs/run @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +#!/bin/sh +set -Cefu MAL_VBS_IMPL_NO_STDERR=1 MAL_VBS_IMPL_ECHO_STDIN=1 \ WSLENV=MAL_VBS_IMPL_NO_STDERR/w:MAL_VBS_IMPL_ECHO_STDIN/w \ -exec cscript.exe -nologo "`wslpath -w "$(dirname $0)/${STEP:-stepA_mal}.vbs"`" "$@" +exec cscript.exe -nologo ${STEP:-stepA_mal}.vbs "$@" diff --git a/impls/vhdl/run b/impls/vhdl/run index 2e60d28742..5201cee735 100755 --- a/impls/vhdl/run +++ b/impls/vhdl/run @@ -1,14 +1,13 @@ -#!/usr/bin/env bash +#!/bin/sh +set -efu # ghdl doesn't allow passing command-line arguments to the VHDL program. To # circumvent that, we write the command-line arguments as lines in # vhdl_argv.tmp, and read the content of that file at the beginning of the VHDL # program. -bin="$(dirname $0)/${STEP:-stepA_mal}" - for arg; do echo "$arg" done > vhdl_argv.tmp -exec $bin +exec ./${STEP:-stepA_mal} diff --git a/impls/vimscript/run b/impls/vimscript/run index 6a98e91302..2cb7a320b4 100755 --- a/impls/vimscript/run +++ b/impls/vimscript/run @@ -1,4 +1,5 @@ #!/bin/sh +set -Cefu # Run Vim in ex mode (-e) and run the given script ($1) on startup. Our scripts # end with 'qall!' which causes actual Vim UI to never start up. @@ -7,10 +8,9 @@ # # See: http://vim.wikia.com/wiki/Vim_as_a_system_interpreter_for_vimscript -rundir=`dirname $0` -export LD_LIBRARY_PATH=`readlink -f $rundir` -vimscriptfile="$(dirname $0)/${STEP:-stepA_mal}.vim" -if [ x$DEBUG = x ] ; then +export LD_LIBRARY_PATH=. +vimscriptfile=${STEP:-stepA_mal}.vim +if [ -n "${DEBUG:-}" ] ; then exec 2> /dev/null fi exec vim -i NONE -V1 -nNesS $vimscriptfile -- "$@" | cat diff --git a/impls/wasm/run b/impls/wasm/run index 764b5d920f..5958c5be40 100755 --- a/impls/wasm/run +++ b/impls/wasm/run @@ -1,17 +1,18 @@ -#!/usr/bin/env bash +#!/bin/sh +set -Cefu case ${wasm_MODE:-js} in wasmtime) - exec wasmtime --dir=./ --dir=../ --dir=/ $(dirname $0)/${STEP:-stepA_mal}.wasm "$@" ;; + exec wasmtime --dir=./ --dir=../ --dir=/ ${STEP:-stepA_mal}.wasm "$@" ;; wasmer) - exec wasmer run --dir=./ --dir=../ --dir=/ $(dirname $0)/${STEP:-stepA_mal}.wasm -- "$@" ;; + exec wasmer run --dir=./ --dir=../ --dir=/ ${STEP:-stepA_mal}.wasm -- "$@" ;; warpy) - exec warpy --argv --memory-pages 256 $(dirname $0)/${STEP:-stepA_mal}.wasm "$@" ;; + exec warpy --argv --memory-pages 256 ${STEP:-stepA_mal}.wasm "$@" ;; wax) - exec wax $(dirname $0)/${STEP:-stepA_mal}.wasm "$@" ;; + exec wax ${STEP:-stepA_mal}.wasm "$@" ;; wace_libc) - exec wace $(dirname $0)/${STEP:-stepA_mal}.wasm "$@" ;; + exec wace ${STEP:-stepA_mal}.wasm "$@" ;; wace_fooboot) echo >&2 "wace_fooboot mode not yet supported" ;; node|js|*) - exec node run.js $(dirname $0)/${STEP:-stepA_mal}.wasm "$@" ;; + exec node run.js ${STEP:-stepA_mal}.wasm "$@" ;; esac diff --git a/impls/wren/run b/impls/wren/run index f8cfe496d9..5709bd1b38 100755 --- a/impls/wren/run +++ b/impls/wren/run @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -exec wren $(dirname $0)/${STEP:-stepA_mal}.wren "$@" +#!/bin/sh +set -Cefu +exec wren ${STEP:-stepA_mal}.wren "$@" diff --git a/impls/yorick/run b/impls/yorick/run index 4f35ebe814..4431fca9b8 100755 --- a/impls/yorick/run +++ b/impls/yorick/run @@ -1,3 +1,3 @@ -#!/usr/bin/env bash -export YORICK_MAL_PATH="$(dirname $0)" -exec yorick -batch "$YORICK_MAL_PATH/${STEP:-stepA_mal}.i" "$@" +#!/bin/sh +set -Cefu +exec yorick -batch ${STEP:-stepA_mal}.i "$@" diff --git a/impls/yorick/step1_read_print.i b/impls/yorick/step1_read_print.i index 8a97cb8cf1..8d4bde5320 100644 --- a/impls/yorick/step1_read_print.i +++ b/impls/yorick/step1_read_print.i @@ -1,4 +1,3 @@ -set_path, get_env("YORICK_MAL_PATH") + ":" + get_path() require, "reader.i" require, "printer.i" diff --git a/impls/yorick/step2_eval.i b/impls/yorick/step2_eval.i index 40730a4967..984679c68b 100644 --- a/impls/yorick/step2_eval.i +++ b/impls/yorick/step2_eval.i @@ -1,4 +1,3 @@ -set_path, get_env("YORICK_MAL_PATH") + ":" + get_path() require, "reader.i" require, "printer.i" require, "core.i" diff --git a/impls/yorick/step3_env.i b/impls/yorick/step3_env.i index 604fb35a20..845ce2572d 100644 --- a/impls/yorick/step3_env.i +++ b/impls/yorick/step3_env.i @@ -1,4 +1,3 @@ -set_path, get_env("YORICK_MAL_PATH") + ":" + get_path() require, "reader.i" require, "printer.i" require, "core.i" diff --git a/impls/yorick/step4_if_fn_do.i b/impls/yorick/step4_if_fn_do.i index 6dac870716..a1bd63e183 100644 --- a/impls/yorick/step4_if_fn_do.i +++ b/impls/yorick/step4_if_fn_do.i @@ -1,4 +1,3 @@ -set_path, get_env("YORICK_MAL_PATH") + ":" + get_path() require, "reader.i" require, "printer.i" require, "core.i" diff --git a/impls/yorick/step5_tco.i b/impls/yorick/step5_tco.i index a9c8ffd96b..4f2011e7f7 100644 --- a/impls/yorick/step5_tco.i +++ b/impls/yorick/step5_tco.i @@ -1,4 +1,3 @@ -set_path, get_env("YORICK_MAL_PATH") + ":" + get_path() require, "reader.i" require, "printer.i" require, "core.i" diff --git a/impls/yorick/step6_file.i b/impls/yorick/step6_file.i index 9780f11926..843c08f024 100644 --- a/impls/yorick/step6_file.i +++ b/impls/yorick/step6_file.i @@ -1,4 +1,3 @@ -set_path, get_env("YORICK_MAL_PATH") + ":" + get_path() require, "reader.i" require, "printer.i" require, "core.i" diff --git a/impls/yorick/step7_quote.i b/impls/yorick/step7_quote.i index 4cd664ac38..c8eb843655 100644 --- a/impls/yorick/step7_quote.i +++ b/impls/yorick/step7_quote.i @@ -1,4 +1,3 @@ -set_path, get_env("YORICK_MAL_PATH") + ":" + get_path() require, "reader.i" require, "printer.i" require, "core.i" diff --git a/impls/yorick/step8_macros.i b/impls/yorick/step8_macros.i index 0060ecec7e..1ffcf9fe18 100644 --- a/impls/yorick/step8_macros.i +++ b/impls/yorick/step8_macros.i @@ -1,4 +1,3 @@ -set_path, get_env("YORICK_MAL_PATH") + ":" + get_path() require, "reader.i" require, "printer.i" require, "core.i" diff --git a/impls/yorick/step9_try.i b/impls/yorick/step9_try.i index 73df6647b9..f3e2308c9a 100644 --- a/impls/yorick/step9_try.i +++ b/impls/yorick/step9_try.i @@ -1,4 +1,3 @@ -set_path, get_env("YORICK_MAL_PATH") + ":" + get_path() require, "reader.i" require, "printer.i" require, "core.i" diff --git a/impls/yorick/stepA_mal.i b/impls/yorick/stepA_mal.i index 5251fafe8c..3205838d51 100644 --- a/impls/yorick/stepA_mal.i +++ b/impls/yorick/stepA_mal.i @@ -1,4 +1,3 @@ -set_path, get_env("YORICK_MAL_PATH") + ":" + get_path() require, "reader.i" require, "printer.i" require, "core.i" diff --git a/impls/zig/run b/impls/zig/run index 9b1b3df961..048ef39072 100755 --- a/impls/zig/run +++ b/impls/zig/run @@ -1,2 +1,3 @@ #!/bin/sh -exec $(dirname $0)/zig-out/bin/${STEP:-stepA_mal} "$@" +set -Cefu +exec zig-out/bin/${STEP:-stepA_mal} "$@" diff --git a/process/guide.md b/process/guide.md index bda640206d..f8ec3f1c59 100644 --- a/process/guide.md +++ b/process/guide.md @@ -113,18 +113,31 @@ quux_STEP_TO_PROG = impls/quux/$($(1)).qx the "STEP" environment variable for the implementation step to run and defaults to "stepA_mal". Make sure the run script has the executable file permission set (or else the test runner might fail with a - permission denied error message). The following are examples of "run" + permission denied error message). + + In order to disambiguate relative paths in command line arguments, + library search paths and so on, "run" will by convention always + executed in the implementation directory. + +``` +cd impls/quux +./run ../tests/step0_repl.mal +``` + + The following are examples of "run" scripts for a compiled language and an interpreted language (where the interpreter is named "quux"): ``` -#!/usr/bin/env bash -exec $(dirname $0)/${STEP:-stepA_mal} "${@}" +#!/bin/sh +set -Cefu +exec ./${STEP:-stepA_mal} "$@" ``` ``` -#!/usr/bin/env bash -exec quux $(dirname $0)/${STEP:-stepA_mal}.qx "${@}" +#!/bin/sh +set -Cefu +exec quux ${STEP:-stepA_mal}.qx "$@" ``` This allows you to run tests against your implementation like this: