diff --git a/readme.md b/readme.md index c51ce97..9eafa28 100644 --- a/readme.md +++ b/readme.md @@ -340,6 +340,7 @@ Content-Type: application/json `haskell`, `husk`, `iverilog`, +`j`, `japt`, `java`, `javascript`, diff --git a/runtimes/902-j.nix b/runtimes/902-j.nix new file mode 100644 index 0000000..5cd2868 --- /dev/null +++ b/runtimes/902-j.nix @@ -0,0 +1,68 @@ +{pkgs, piston, ...}: +let + # Put your package here, preferibly from nixpkgs. + pkg = pkgs.902; # this may be incorrect - it is guessed +in piston.mkRuntime { + # Name of the language implemented by this runtime + language = "j"; + + # The version of the language + # Usually this is specified on the package + version = pkg.version; + + # Name of the runtime + # This line should be kept if the runtime differs from the language + runtime = "902"; + + aliases = [ + # Put extensions in here, and other common names + # Example: + # "js" + # "node-javascript" + ]; + + + + # This is the lines of a shell script to compile source code. + # Arguments passed to this script are all the provided source files + # The CWD of this script is a temp directory for a job + # + # If the language only supports JIT compiling, simply remove this line + # See ./python3.nix and ./node-javascript.nix for examples + # + # No shebang needs to be added to this - that is done automatically. + compile = '' + ${pkg}/bin/902 --compile "$@" + ''; + + # This is the lines of a shell script to evaluate a file at $1 + # The remaining arguments are the arguments to launch the application with + # The CWD of this script is a temp directory for a job + # + # If the compile stage is used, $1 still contains the name of the source file. + # It is up to your script to determine the filename of the emitted binary + # + # No shebang needs to be added to this - that is done automatically. + run = '' + ${pkg}/bin/902 "$@" + ''; + + # Specify a list of tests. + # These should output "OK" to STDOUT if everything looks good + # + # Run the following command to test the package: + # $ ./piston test 902-j + tests = [ + (piston.mkTest { + files = { + "test.js" = '' + console.log("OK"); + ''; + }; + args = []; + stdin = ""; + packages = []; + main = "test.js"; + }) + ]; +} \ No newline at end of file diff --git a/runtimes/default.nix b/runtimes/default.nix index 140fd83..885b864 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -51,4 +51,5 @@ args: { "gcc-fortran" = import ./gcc-fortran.nix args; "yabasic" = import ./yabasic.nix args; "emacs" = import ./emacs.nix args; + "j" = import ./j.nix args; } diff --git a/runtimes/j.nix b/runtimes/j.nix new file mode 100644 index 0000000..667797f --- /dev/null +++ b/runtimes/j.nix @@ -0,0 +1,68 @@ +{pkgs, piston, ...}: +let + # Put your package here, preferibly from nixpkgs. + pkg = pkgs.j; # this may be incorrect - it is guessed +in piston.mkRuntime { + # Name of the language implemented by this runtime + language = "j"; + + # The version of the language + # Usually this is specified on the package + version = pkg.version; + + # Name of the runtime + # This line should be kept if the runtime differs from the language + runtime = "j"; + + aliases = [ + # Put extensions in here, and other common names + # Example: + # "js" + # "node-javascript" + ]; + + + + # This is the lines of a shell script to compile source code. + # Arguments passed to this script are all the provided source files + # The CWD of this script is a temp directory for a job + # + # If the language only supports JIT compiling, simply remove this line + # See ./python3.nix and ./node-javascript.nix for examples + # + # No shebang needs to be added to this - that is done automatically. + compile = '' + ${pkg}/bin/j --compile "$@" + ''; + + # This is the lines of a shell script to evaluate a file at $1 + # The remaining arguments are the arguments to launch the application with + # The CWD of this script is a temp directory for a job + # + # If the compile stage is used, $1 still contains the name of the source file. + # It is up to your script to determine the filename of the emitted binary + # + # No shebang needs to be added to this - that is done automatically. + run = '' + ${pkg}/bin/j "$@" + ''; + + # Specify a list of tests. + # These should output "OK" to STDOUT if everything looks good + # + # Run the following command to test the package: + # $ ./piston test j + tests = [ + (piston.mkTest { + files = { + "test.js" = '' + console.log("OK"); + ''; + }; + args = []; + stdin = ""; + packages = []; + main = "test.js"; + }) + ]; +} \ No newline at end of file