AlgoML
FR

Pseudo-code that compiles to real programs

AlgoML is a simple algorithmic language for learning and teaching programming. Write your algorithm once and get working code in C, Java and Python.

No errorsOpen in PlaygroundSoon
factorial.aml
1Algorithm Factorial
2version '1.0'
3language C
4
5function factorial(n : INT) : INT
6begin
7 if n <= 1 then
8 return 1
9 end if
10 return n * factorial(n - 1)
11end function
12
13variable n : INT
14variable result : INT
15
16begin
17 read(n)
18 result <- factorial(n)
19 write(n, "! = ", result, "\n")
20end
21end algorithm
1#include <stdio.h>
2
3int n;
4int result;
5
6int factorial(int n);
7
8int factorial(int n) {
9 if (n <= 1) {
10 return 1;
11 }
12 return n * factorial((n - 1));
13}
14
15int main() {
16 scanf("%d", &n);
17 result = factorial(n);
18 printf("%d! = %d\n", n, result);
19 return 0;
20}
Input 5Output 5! = 120

Learn AlgoML

Six short chapters. Each one has examples you can run and an exercise with its solution.

  1. 1Your first programProgram structure, variables, read and write
  2. 2Conditionsif, elseif, else, switch, AND, OR, NOT
  3. 3Loopsfor, while, repeat until
  4. 4Functions and proceduresParameters, return values, recursion
  5. 5ArraysDeclaring, filling and sorting an array
  6. 6StructuresGrouping data into records with fields

Cheat sheet

An AlgoML instruction and what it becomes in the language you pick.

AlgoML vs
variable x : INTint x;
x <- 5x = 5;
a <> ba != b
a div ba / b
a mod ba % b
NOT ok AND x > 0!ok && x > 0
for i in 1 to n dofor (i = 1; i <= n; i += 1)
tab[i]tab[i - 1]
read(n)scanf("%d", &n);
write("x = ", x)printf("x = %d", x);

Full reference for every language

Example programs

Every example from the docs lives in one public repository, with its input and expected output. Clone it and open it in VS Code.

Browse the examples
git clone https://github.com/scmc24/algoml-examples.git

Projects using AlgoML

Course material, exercise sets and algorithm collections shared on GitHub.

See all projects

No project listed yet. Yours could be the first one.

Add your project

Start in two minutes

Install the VS Code extension, open a .aml file and generate code with one click. Java 17 or later is needed.

Downloads and install guides