This repository contains examples of 100+ programming languages.
Besides just showing example programs, the programs are runnable in a reproducible manner via Dockerfiles. Additionally, the programs are unit tested to ensure they indeed produce the expected output(s).
Podman is used to build and execute a multi-layer image.
| Layer | Name | Description |
|---|---|---|
| 1 | base |
Debian 13 (Trixie), Systemd, Snap, common apt packages. |
| 2 | system |
Things shared between all languages (entry point, tests...). |
| 3 | language |
Things shared within a language (language-specific setup...) |
| 4 | program |
The specific program for the language. |
This provides the following (for example):
- Changing a unit test (
systemlayer) does not require re-installing apt packages (baselayer). - Changing a language setup script (
languagelayer) does not require rebuilding thebaseorsystemlayers. - Changing a program does not require rebuilding any other layer (
base,system, orlanguage).
$ ./languages.sh --help
languages.sh 0.0.0.0
Usage:
languages.sh [options] <command>
Options:
--configure Install needed dependencies, etc.
--debug Debug everything.
--debug-container Debug container building, etc.
--debug-program Debug program execution.
--debug-setup Debug language setup script.
--help Show this help message.
--interactive Begin an interaction session.
--parallel Runs multiple programs concurrently.
--prime Pre-generates image(s) without running them.
--reverse Runs programs in reverse order.
--test Run unit tests.
--version Show version information.
Commands:
clean Remove stored images and containers.
list List languages and their programs.
run Run all languages and programs.
run <LANGUAGE> Run all programs for a language.
run <LANGUAGE> <PROGRAM> Run a specific language's program.
- List available languages and programs:
./languages.sh list
- Run everything:
./languages.sh run
- Run all C# programs:
./languages.sh run csharp
- Run the C# hello program:
./languages.sh run csharp hello
- Debug the C# hello program:
./languages.sh --debug run csharp hello
- Enter interactive mode for C#, with the hello program loaded:
./languages.sh --interactive csharp hello
- Run tests for Rust (all programs):
./languages.sh --test run rust
- Help/usage:
./languages.sh --help
- Version:
./languages.sh --version
This program should print Hello, world!, with a trailing newline, and exit with status 0.
This program should print the sum of 0-100 (inclusive), which is 5050, with a trailing newline, and exit with status 0.
This program converts a string, as may be typed into a simple microwave, into MM:SS format, with a trailing newline.
The input must be passed as a single positional argument to the program. Any other usage is an error.
A usage error should exit with status 1. An invalid argument should exit with status 2.
Correct behavior is based on the Whirlpool WMH31017HZ-2 (my kitchen microwave). This is a common kitchen microwave that is customarily installed above a range/stove. I have observed that other microwaves have varying behavior for strange inputs, such as 161 or 9999. I chose this microwave as my source of truth merely because I have easy access to it.
Do not run a microwave without something in it to absorb the magnetron's radiation, or your microwave may damage itself. I used a large bowl of water to test behavior for inputs such as 9999.
Valid input examples
0000 → 00:00 |
60 → 01:00 |
960 → 10:00 |
9959 → 99:59 |
000 → 00:00 |
61 → 01:01 |
961 → 10:01 |
9960 → 99:60 |
00 → 00:00 |
90 → 01:30 |
999 → 10:39 |
9961 → 99:61 |
0 → 00:00 |
99 → 01:39 |
1000 → 10:00 |
9999 → 99:99 |
1 → 00:01 |
100 → 01:00 |
1001 → 10:01 |
|
59 → 00:59 |
101 → 01:01 |
||
159 → 01:59 |
|||
160 → 02:00 |
|||
161 → 02:01 |
|||
199 → 02:39 |
|||
200 → 02:00 |
|||
201 → 02:01 |
|||
959 → 09:59 |
Invalid input examples
- Empty string
xxxxx-112345
These programs are intended to demonstrate unique or interesting language features.
Test requirements are loose:
- There must be standard output (stdout).
- There must not be error output (stderr).
- Exit status must be 0.
| Language | hello |
sum |
microwave |
freestyle |
|---|---|---|---|---|
| Ada | ✅ | ✅ | ⬜ | ⬜ |
| Algol | ✅️ | ✅ | ⬜ | ⬜ |
| APL | ✅️ | ✅️ | ⬜ | ⬜ |
| Arturo | ✅ | ✅ | ⬜ | ⬜ |
| Assembly (GNU) | ✅ | ✅ | ⬜ | ⬜ |
| Assembly (Microsoft) | ✅ | ✅ | ⬜ | ⬜ |
| Assembly (Netwide) | ✅ | ✅ | ⬜ | ⬜ |
| Awk | ✅ | ✅ | ⬜ | ⬜ |
| B | ✅ | ✅ | ⬜ | ⬜ |
| B4X | ⬜ | ⬜ | ⬜ | ⬜ |
| Ballerina | ✅ | ✅ | ⬜ | ⬜ |
| Bash | ✅ | ✅ | ✅ | ✅ |
| BASIC¹ | ✅ | ✅ | ⬜ | ⬜ |
| Batch | ✅ | ✅ | ⬜ | ⬜ |
| BCPL | ✅ | ✅ | ⬜ | ⬜ |
| Beanshell | ✅ | ✅ | ⬜ | ⬜ |
| Beef | ✅ | ✅ | ⬜ | ⬜ |
| Brainf#ck | ✅ | ⬜ | ⬜ | ⬜ |
| C | ✅ | ✅ | ✅ | ⬜ |
| C# | ✅ | ✅ | ✅ | ⬜ |
| C++ | ✅ | ✅ | ✅ | ⬜ |
| C2 | ✅ | ✅ | ⬜ | ⬜ |
| C3 | ✅ | ✅ | ⬜ | ⬜ |
| Caml | ✅ | ✅ | ⬜ | ⬜ |
| Carbon | ✅ | ✅ | ⬜ | ⬜ |
| Chapel | ✅ | ✅ | ✅ | ⬜ |
| ChucK | ✅ | ✅ | ⬜ | ✅ |
| Clojure | ✅ | ✅ | ⬜ | ⬜ |
| CLU | ✅ | ✅ | ⬜ | ⬜ |
| COBOL | ✅ | ✅ | ⬜ | ⬜ |
| Cobra | ✅ | ✅ | ⬜ | ⬜ |
| CoffeeScript | ✅ | ✅ | ⬜ | ⬜ |
| ColdFusion | ✅ | ✅ | ⬜ | ⬜ |
| Cowgol | ✅ | ✅ | ⬜ | ⬜ |
| Crystal | ✅ | ✅ | ⬜ | ⬜ |
| Csound | ✅ | ✅ | ⬜ | ✅ |
| CSS¹ | ✅ | ✅ | ||
| Cwerg | ⬜ | ⬜ | ⬜ | ⬜ |
| D | ✅ | ✅ | ✅ | ⬜ |
| Dart | ✅ | ✅ | ⬜ | ⬜ |
| Daslang | ✅ | ✅ | ⬜ | ⬜ |
| dBase | ⬜ | ⬜ | ⬜ | ⬜ |
| Delphi | ✅ | ✅ | ⬜ | ⬜ |
| E | ✅ | ✅ | ⬜ | ⬜ |
| Eiffel | ✅ | ✅ | ⬜ | ⬜ |
| Elixir | ✅ | ✅ | ⬜ | ⬜ |
| Elm | ✅ | ✅ | ⬜ | ⬜ |
| Emacs Lisp | ✅ | ✅ | ⬜ | ⬜ |
| Erlang | ✅ | ✅ | ⬜ | ⬜ |
| Extempore | ⬜ | ⬜ | ⬜ | ⬜ |
| F# | ✅ | ✅ | ⬜ | ⬜ |
| Factor | ✅ | ✅ | ⬜ | ⬜ |
| Fifth | ✅ | ✅ | ⬜ | ⬜ |
| Forth | ✅ | ✅ | ⬜ | ⬜ |
| Fortran | ✅ | ✅ | ⬜ | ⬜ |
| FoxPro | ⬜ | ⬜ | ⬜ | ⬜ |
| Futhark | ✅ | ⬜ | ⬜ | |
| G-Portugol | ✅ | ✅ | ⬜ | ⬜ |
| Gambas | ⬜ | ⬜ | ⬜ | ⬜ |
| GAMS | ⬜ | ⬜ | ⬜ | ⬜ |
| GAP | ⬜ | ⬜ | ⬜ | ⬜ |
| GDScript | ⬜ | ⬜ | ⬜ | ⬜ |
| Gleam | ✅️ | ✅️ | ⬜ | ⬜ |
| Glim | ⬜ | ⬜ | ⬜ | ⬜ |
| Go | ✅️ | ✅ | ⬜ | ⬜ |
| Groovy | ✅️ | ✅ | ⬜ | ⬜ |
| Gurgle | ⬜ | ⬜ | ⬜ | ⬜ |
| Hack | ✅ | ✅ | ⬜ | ⬜ |
| Hare | ✅ | ✅ | ⬜ | ⬜ |
| Haskell | ✅ | ✅ | ⬜ | ⬜ |
| Haxe | ✅ | ✅ | ⬜ | ⬜ |
| Hopper | ⬜ | ⬜ | ⬜ | ⬜ |
| HTML¹ | ✅ | |||
| HyperTalk | ⬜ | ⬜ | ⬜ | ⬜ |
| Icon | ✅ | ✅ | ⬜ | ⬜ |
| Inform | ✅ | ✅ | ⬜ | ⬜ |
| Ink | ✅ | ✅ | ⬜ | ⬜ |
| Io | ✅ | ✅ | ⬜ | ⬜ |
| Irdis | ⬜ | ⬜ | ⬜ | ⬜ |
| Isabelle¹ | ✅ | ✅ | ⬜ | ⬜ |
| J | ⬜ | ⬜ | ⬜ | ⬜ |
| J# | ⬜ | ⬜ | ⬜ | ⬜ |
| Jai | ⬜ | ⬜ | ⬜ | ⬜ |
| Java | ✅ | ✅ | ✅ | ⬜ |
| JavaScript | ✅ | ✅ | ✅ | ⬜ |
| Joule | ⬜ | ⬜ | ⬜ | ⬜ |
| Joy¹ | ✅ | ✅ | ⬜ | ⬜ |
| JS++ | ⬜ | ⬜ | ⬜ | ⬜ |
| JScript | ⬜ | ⬜ | ⬜ | ⬜ |
| Jtw | ⬜ | ⬜ | ⬜ | ⬜ |
| Julia | ✅ | ✅ | ⬜ | ⬜ |
| Koka | ⬜ | ⬜ | ⬜ | ⬜ |
| Kotlin | ✅ | ✅ | ⬜ | ⬜ |
| LabVIEW | ⬜ | ⬜ | ⬜ | ⬜ |
| Ladder Logic | ⬜ | ⬜ | ⬜ | ⬜ |
| Less¹ | ✅ | ✅ | ⬜ | ⬜ |
| Lily (A) | ✅ | ✅ | ⬜ | ⬜ |
| Lily (B) | ✅ | ✅ | ⬜ | ⬜ |
| Lisp | ✅ | ✅ | ⬜ | ⬜ |
| Lobster | ✅ | ✅ | ⬜ | ⬜ |
| Logo | ✅ | ✅ | ⬜ | ⬜ |
| Lua | ✅ | ✅ | ⬜ | ⬜ |
| Maple | ⬜ | ⬜ | ⬜ | ⬜ |
| MATLAB | ✅ | ✅ | ⬜ | ⬜ |
| Maxima | ⬜ | ⬜ | ⬜ | ⬜ |
| Modelica | ⬜ | ⬜ | ⬜ | ⬜ |
| Modula | ⬜ | ⬜ | ⬜ | ⬜ |
| Modula-2 | ✅ | ✅ | ⬜ | ⬜ |
| Modula-3 | ⬜ | ⬜ | ⬜ | ⬜ |
| Mojo | ✅ | ✅ | ⬜ | ⬜ |
| NATURAL | ⬜ | ⬜ | ⬜ | ⬜ |
| Nemerle | ✅ | ✅ | ⬜ | ⬜ |
| Never | ✅ | ✅ | ⬜ | ⬜ |
| Newspeak | ⬜ | ⬜ | ⬜ | ⬜ |
| Nial | ✅ | ✅ | ⬜ | ⬜ |
| Nim | ⬜ | ⬜ | ⬜ | ⬜ |
| Nit | ⬜ | ⬜ | ⬜ | ⬜ |
| Nix | ✅ | ✅ | ⬜ | ⬜ |
| NXT-G | ⬜ | ⬜ | ⬜ | ⬜ |
| Oak | ✅ | ✅ | ⬜ | ⬜ |
| Oberon | ✅ | ✅ | ⬜ | ⬜ |
| Object Pascal | ✅ | ✅ | ⬜ | ⬜ |
| Objective-C | ✅ | ✅ | ⬜ | ⬜ |
| Oblique | ⬜ | ⬜ | ⬜ | ⬜ |
| OCaml | ✅ | ✅ | ⬜ | ⬜ |
| Odin | ⬜ | ⬜ | ⬜ | ⬜ |
| Opa | ⬜ | ⬜ | ⬜ | ⬜ |
| OpenCL | ⬜ | ⬜ | ⬜ | ⬜ |
| Par | ✅ | ✅ | ⬜ | ⬜ |
| Pascal | ✅ | ✅ | ⬜ | ⬜ |
| Perl | ✅ | ✅ | ⬜ | ⬜ |
| Phix | ⬜ | ⬜ | ⬜ | ⬜ |
| PHL | ⬜ | ⬜ | ⬜ | ⬜ |
| PHP | ✅ | ✅ | ⬜ | ⬜ |
| Pike | ⬜ | ⬜ | ⬜ | ⬜ |
| PL/I | ⬜ | ⬜ | ⬜ | ⬜ |
| PL/M¹ | ✅ | ✅ | ⬜ | ⬜ |
| PL/SQL | ⬜ | ⬜ | ⬜ | ⬜ |
| Planner | ⬜ | ⬜ | ⬜ | ⬜ |
| Pony | ✅ | ✅ | ⬜ | ⬜ |
| POP-11 | ⬜ | ⬜ | ⬜ | ⬜ |
| PostScript | ✅ | ✅ | ⬜ | ⬜ |
| PowerShell | ✅ | ✅ | ⬜ | ⬜ |
| Project Verona | ⬜ | ⬜ | ⬜ | ⬜ |
| Prolog | ✅ | ✅ | ⬜ | ⬜ |
| Pure | ⬜ | ⬜ | ⬜ | ⬜ |
| Python | ✅ | ✅ | ⬜ | ⬜ |
| Q | ⬜ | ⬜ | ⬜ | ⬜ |
| R | ✅ | ✅ | ⬜ | ⬜ |
| Racket | ✅ | ✅ | ⬜ | ⬜ |
| Raku | ⬜ | ⬜ | ⬜ | ⬜ |
| Rebol | ⬜ | ⬜ | ⬜ | ⬜ |
| Red | ⬜ | ⬜ | ⬜ | ⬜ |
| Rexx | ✅ | ✅ | ⬜ | ⬜ |
| Ring | ⬜ | ⬜ | ⬜ | ⬜ |
| Roc | ✅ | ✅ | ⬜ | ⬜ |
| RPG (IV) | ✅ | ✅ | ⬜ | ⬜ |
| RPL | ⬜ | ⬜ | ⬜ | ⬜ |
| Ruby | ✅ | ✅ | ⬜ | ⬜ |
| Rust | ✅ | ✅ | ✅ | ⬜ |
| SAS | ⬜ | ⬜ | ⬜ | ⬜ |
| Sass¹ | ✅ | ✅ | ⬜ | ⬜ |
| Sather | ⬜ | ⬜ | ⬜ | ⬜ |
| Scala | ✅ | ✅ | ⬜ | ⬜ |
| Scheme | ✅ | ✅ | ⬜ | ⬜ |
| Scratch | ⬜ | ⬜ | ⬜ | ⬜ |
| Sed | ✅ | ✅ | ⬜ | ⬜ |
| Seed7 | ✅ | ✅ | ⬜ | ⬜ |
| Self | ⬜ | ⬜ | ⬜ | ⬜ |
| Simula | ✅ | ✅ | ⬜ | ⬜ |
| Smalltalk | ✅ | ✅ | ⬜ | ⬜ |
| Solidity | ⬜ | ⬜ | ⬜ | ⬜ |
| Sonic Pi | ⬜ | ⬜ | ⬜ | ⬜ |
| SPARK | ✅ | ✅ | ⬜ | ⬜ |
| Spin (Parallax) | ⬜ | ⬜ | ⬜ | ⬜ |
| SQL¹ | ✅ | ✅ | ✅ | ⬜ |
| Squeak | ⬜ | ⬜ | ⬜ | ⬜ |
| Squirrel | ⬜ | ⬜ | ⬜ | ⬜ |
| Standard ML¹ | ✅ | ✅ | ⬜ | ⬜ |
| SuperCollider | ✅ | ✅ | ⬜ | ✅ |
| Stata | ⬜ | ⬜ | ⬜ | ⬜ |
| Storm | ⬜ | ⬜ | ⬜ | ⬜ |
| Structured Text | ⬜ | ⬜ | ⬜ | ⬜ |
| Swift | ✅ | ✅ | ⬜ | ⬜ |
| Tampio¹ | ✅ | ⬜ | ⬜ | ⬜ |
| Tcl | ✅ | ✅ | ⬜ | ⬜ |
| Tern | ⬜ | ⬜ | ⬜ | ⬜ |
| Toi | ✅ | ✅ | ⬜ | ⬜ |
| Transact-SQL | ⬜ | ⬜ | ⬜ | ⬜ |
| Typescript | ✅ | ✅ | ⬜ | ⬜ |
| Unicon | ⬜ | ⬜ | ⬜ | ⬜ |
| V | ✅ | ✅ | ⬜ | ⬜ |
| Vala | ✅ | ✅ | ⬜ | ⬜ |
| Vale | ⬜ | ⬜ | ⬜ | ⬜ |
| VBScript | ⬜ | ⬜ | ⬜ | ⬜ |
| Verilog | ✅ | ✅ | ⬜ | ⬜ |
| VHDL | ✅ | ✅ | ⬜ | ⬜ |
| Visual Basic .NET | ✅ | ✅ | ⬜ | ⬜ |
| Visual Basic (6) | ⛔ | ⬜ | ⬜ | ⬜ |
| Wenyan (文言) | ✅ | ⛔ | ⬜ | ⬜ |
| Whiley | ✅ | ✅ | ⬜ | ⬜ |
| Wolfram | ✅ | ✅ | ⬜ | ⬜ |
| Wren | ⬜ | ⬜ | ⬜ | ⬜ |
| X10 | ✅ | ✅ | ⬜ | ⬜ |
| Xojo | ⬜ | ⬜ | ⬜ | ⬜ |
| Xtend | ✅ | ✅ | ⬜ | ⬜ |
| Zig | ✅ | ✅ | ✅ | ⬜ |
| Count... | 133 | 130 | 11 | 4 |
Legend
| Symbol | Meaning |
|---|---|
| ✅ | Completed |
| Unimplementable | |
| ⛔ | Failing |
| ⬜ | Unimplemented |
| ¹ | "Cheating" required. |
Some programs require "cheating" to express output and/or pass tests.
See the cheating page for additional information.