AlgoML
FR

Introduction

What AlgoML is, who it is for and how it turns an algorithm into a program.

AlgoML is an algorithmic language: you describe the steps of a solution in simple words such as if, while and return, close to the pseudo-code used in class. The AlgoML generator then turns that algorithm into a real program in C, Java or Python.

Why AlgoML

When you start programming, two things are hard at the same time: thinking like an algorithm and fighting with the details of a language (semicolons, braces, types, scanf). AlgoML lets you work on the first one first. Once the algorithm is right, you see how it is written in a real language, line by line.

  • Students write and test their algorithms, then compare them with the generated C, Java or Python.
  • Teachers give exercises in one notation and check the result by running it.
  • Anyone can prototype an algorithm and get a starting point in several languages.

A first look

Here is a complete AlgoML program. Use the tabs to see the code generated for each language.

Algorithm Factorial
version '1.0'
language C
function factorial(n : INT) : INT
begin
if n <= 1 then
return 1
end if
return n * factorial(n - 1)
end function
variable n : INT
variable result : INT
begin
read(n)
result <- factorial(n)
write(n, "! = ", result, "\n")
end
end algorithm
Input 5Output 5! = 120factorial.aml on GitHubTry itSoon

How it works

  1. You write an .aml file, in VS Code or any text editor.
  2. The checker reads it and reports errors with a clear message: an undeclared variable, a REAL stored in an INT, a function that never returns.
  3. The generator writes the program in the language named on the language line of the file.
  4. You compile and run the generated program like any other.

What you need

  • Java 17 or later, used by the generator.
  • The VS Code extension, or the command-line generator. See Installation.

Next step

Install AlgoML, then follow Your first program.

Report a problem with this page