Moodle CodeRunner

Scala, Haskell, SQL, Swift and more in CodeRunner

CodeRunner can grade any language its Jobe server runs. The built-in question types cover a handful; for the rest you write a question type of your own, and on your own Jobe you first install the language and fight its limits. Here is what each language takes, and a server where 46 languages already run.

By the OnlineCompiler.io team. Updated .

What CodeRunner has built in

Each built-in question type names the Jobe language it runs. With a Jobe server that has the language installed, these work out of the box:

Question typesJobe language
c_function, c_programc
cpp_function, cpp_programcpp
java_class, java_method, java_programjava
nodejsnodejs
octave_functionoctave
pascal_function, pascal_programpascal
phpphp
python3, python3_w_inputpython3
sqlpython3, calling the sqlite3 program

Anything else needs a user-defined question type (a prototype) whose Sandbox language names the language. CodeRunner's documentation recommends driving new languages from a python3 template that calls the compiler, which works when the language is installed on the same Jobe server.

What it takes on your own Jobe

On a self-hosted Jobe, the language has to be installed, and then it has to fit Jobe's limits:

LanguageWhat people hitThread
Scala 3scala-cli writes to a home directory Jobe users don't have (AccessDeniedException: /home/jobe00/.cache), then the JVM runs out of threads (pthread_create failed). Scala 3 is not in apt.jobe#92, open
Haskellghc: failed to create OS thread: Cannot allocate memory, until the memory limit is lifted.jobe#83
SQLThe built-in sql type needs the sqlite3 command-line program on the Jobe server, and only SQLite is supported.jobe#41
OctavePulls in X and GNOME on Ubuntu unless installed without recommends; libopenblas fails to load under a tight memory limit.jobe#33, #38
SwiftNo Swift-specific advice; the answer was to read the docs on new languages and ask on the forum.CodeRunner#268
RNot a Jobe language: install R on the Jobe server and drive it from a python3 template.CodeRunner#283

The usual fix for the JVM languages and Haskell is a higher MemLimit and a numprocs above the default in the prototype's Parameters; for Scala 3 the maintainer also suggested a longer time limit. Jobe's process errors covers the limits in more detail.

Already installed on a hosted Jobe-compatible server

OnlineCompiler.io answers CodeRunner in Jobe's format and runs 46 languages, each in its own sandbox with the compiler already installed. Besides Jobe's own ids (c, cpp, java, nodejs, octave, pascal, php, python3), a question type can name any of these as its sandbox language:

Sandbox languageRuns on
adaAda (GNAT 15)
bashBash (5.2)
clojureClojure (1.12)
cobolCOBOL (GnuCOBOL 3.2)
crystalCrystal (1.22)
csharpC# (.NET SDK 10)
dD (LDC 1.43)
dartDart (3.13)
duckdbDuckDB (1.5)
elixirElixir (1.20)
erlangErlang (OTP 29)
fortranFortran (gfortran 15)
freebasicFreeBASIC (1.10)
fsharpF# (.NET SDK 10)
goGo (1.26)
groovyGroovy (6.0)
haskellHaskell (GHC 9.12)
juliaJulia (1.13)
kotlinKotlin (2.4)
lispCommon Lisp (SBCL 2.6)
luaLua (5.5)
nasmAssembly (NASM 3)
nimNim (2.2)
objectivecObjective-C (Clang 21)
ocamlOCaml (5.4)
perlPerl (5.44)
powershellPowerShell (7.6)
prologProlog (SWI-Prolog 10)
rR (4.6)
racketRacket (9.3)
rubyRuby (4.0)
rustRust (1.93)
scalaScala (3.10)
sqliteSQL (SQLite 3)
swiftSwift (6.4)
typescriptTypeScript (Deno)
vbnetVisual Basic (.NET SDK 10)
zigZig (0.17)

These answers to "read n and print its square" were each sent through the Jobe API with input 7 on 2 November 2026, and printed 49:

Scala 3 (sandbox language scala)
@main def run() =
  val n = scala.io.StdIn.readInt()
  println(n * n)
Haskell (sandbox language haskell)
main :: IO ()
main = do
  n <- readLn :: IO Int
  print (n * n)
Swift (sandbox language swift)
let n = Int(readLine()!)!
print(n * n)
Octave (sandbox language octave)
n = scanf('%d', 1);
disp(n * n)

The limits are fixed: 512 MB of memory and up to 16 processes per run, whatever MemLimit and numprocs say, and the question's time limit up to 30 seconds. Scala and Haskell run within them without extra settings.

Make a question type for a new language

This makes a haskell_program type: students write a whole program, and each test case gives it standard input and checks its output. The same steps work for any id in the table above. They follow CodeRunner's documentation on user-defined question types.

  1. In the question bank where you keep prototypes (a category such as LOCAL_PROTOTYPES; on Moodle 5, a question bank in the course), add a new CodeRunner question with question type python3.
  2. Name it, for example PROTOTYPE_haskell_program. Its question text becomes the description teachers see under Question type details.
  3. Tick Customise. Replace the template with just the student's answer, and untick Is combinator so each test runs on its own with its own standard input:
    Template
    {{ STUDENT_ANSWER }}
  4. Open Advanced customisation. Set Is prototype? to Yes (user defined), Question type to haskell_program, Sandbox language to haskell and Ace language to haskell. The sandbox language is free text and must match the server's id exactly.
  5. Save. New questions can now choose haskell_program as their question type; give each test case a Standard input and the Expected output.

CodeRunner's documentation adds a few rules: don't edit or copy the built-in prototypes, which are replaced on upgrade; export a prototype together with the questions that use it, because deleting it breaks them with "missing prototype"; and test cases on a prototype are not inherited by its questions.

SQL questions

The built-in sql question type is a python3 template that runs the sqlite3 command-line program. Attach exactly one .db file to the question as a support file; for each test, the template copies a fresh database, then runs the test's extra commands, the student's query and the test code, and shows the result in sqlite3's column mode. A server needs both Python and the sqlite3 program for this, and OnlineCompiler.io's Python sandbox has both.

For SQL that sets up its own tables, a user-defined type can use sqlite (SQLite 3) or duckdb as its sandbox language instead; the answer then runs as a script against an empty database.

Keep your Jobe, send only some languages elsewhere

CodeRunner reads jobeserver and jobeapikey from a question's Parameters (under Advanced customisation), and a prototype passes its parameters on to the questions built on it. So a lecturer can send just one question type, or one course, to another server without changing the site settings:

Parameters
{"jobeserver": "https://api.onlinecompiler.io/api", "jobeapikey": "YOUR_API_KEY"}

We tested this on 2 November 2026 with Moodle 4.5 and CodeRunner 5.10.9: on a site whose own Jobe server was unreachable, a question with these parameters graded a right answer as right and a wrong one as wrong. The key sits in the question, so anyone who can edit or export it can read it; create a separate key for it on your API keys page, and deactivate it when you're done.

Get started

For a whole site, set CodeRunner's Jobe server to https://api.onlinecompiler.io/api and its Jobe API key to an OnlineCompiler.io API key; for one course, use the parameters above. The free plan includes 100,000 runs a month. CodeRunner without a Jobe server has the full setup and a first question, and the Jobe-compatible API page lists every difference from Jobe, including that the built-in multilanguage type doesn't work. For questions to start from, the free CodeRunner question packs cover Python, Java, C and C++ with CodeRunner's built-in types.

Frequently asked questions

Can CodeRunner grade Haskell, Scala, Swift, Go or Rust?

Yes, with a user-defined question type whose sandbox language is that language's id, and a Jobe server that runs it. OnlineCompiler.io's Jobe-compatible server runs 46 languages, including haskell, scala, swift, go and rust.

Why does a custom question type say the language is not known?

The Sandbox language field is free text and must match an id the Jobe server lists at /jobe/index.php/restapi/languages exactly. Check the spelling against the table on this page, or against that list on your own server.

Do CodeRunner SQL questions work without installing sqlite3?

The built-in sql question type runs a Python template that calls the sqlite3 command-line program, so the server must have it. OnlineCompiler.io's server does. Each question needs exactly one .db file attached as a support file.

Can I keep my own Jobe server and use another one for some languages?

Yes. CodeRunner reads jobeserver and jobeapikey from a question's Parameters, so a prototype with {"jobeserver": "https://api.onlinecompiler.io/api", "jobeapikey": "..."} sends only its questions to that server, without changing the site settings.

Do MemLimit and numprocs settings apply on the hosted server?

No. Every run there has 512 MB of memory and up to 16 processes, whatever the question says, and the time limit is the question's, up to 30 seconds. Scala and Haskell run within those limits without changes.