diff --git a/src/languages/elixir.ts b/src/languages/elixir.ts new file mode 100644 index 0000000..163577b --- /dev/null +++ b/src/languages/elixir.ts @@ -0,0 +1,181 @@ +export const lang = { + + + + name: "elixir", + + + + sourceFileName: "a.ex", + + + + fileExtension: "ex", + + + + binarySizeLimit: 5000 * 1024, + + + + + + + + // Note that these two paths are in the sandboxed environment. + + + + compile: (sourcePath, outputDirectory) => ({ + + + + // To customize the compilation process, + + + + // write a shell script or some other stuff, + + + + // and put it to your sandbox. + + + + executable: "/usr/bin/elixirc", + + + + parameters: ["elixirc", sourcePath, outputDirectory, "elixirc a.ex"], + + + + time: 5000, + + + + memory: 1024 * 1024 * 1024, + + + + process: 10, + + + + // This is just a redirection. You can simply ignore this + + + + // if you can specify custom location for message output + + + + // in the parameter of the compiler, or have redirected the compilation + + + + // message to somewhere. + + + + // An example will be available soon. + + + + stderr: `${outputDirectory}/message.txt`, + + + + // We will read this file for message in the output directory. + + + + messageFile: 'message.txt', + + + + workingDirectory: outputDirectory + + + + }), + + + + + + + + run: (binaryDirectory: string, + + + + workingDirectory: string, + + + + time: number, + + + + memory: number, + + + + stdinFile = null, + + + + stdoutFile = null, + + + + stderrFile = null + + + + ) => ({ + + + + executable: "/usr/bin/elixir", + + + + parameters: ["elixir", `${binaryDirectory}/a.ex`, "-e \"Main.main()\""], + + + + time: time, + + + + memory: memory, + + + + process: 1, + + + + stdin: stdinFile, + + + + stdout: stdoutFile, + + + + stderr: stderrFile, + + + + workingDirectory: workingDirectory + + + + }) + + + +}; diff --git a/src/languages/index.ts b/src/languages/index.ts index e56c860..c18fe6b 100644 --- a/src/languages/index.ts +++ b/src/languages/index.ts @@ -44,5 +44,6 @@ export const languages : Language[] = [ require('./python3'), require('./ruby'), require('./vala'), + require('./elixir'), require('./vbnet') -].map(f => f.lang); \ No newline at end of file +].map(f => f.lang);