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 Factorialversion '1.0'language Cfunction factorial(n : INT) : INTbeginif n <= 1 thenreturn 1end ifreturn n * factorial(n - 1)end functionvariable n : INTvariable result : INTbeginread(n)result <- factorial(n)write(n, "! = ", result, "\n")endend algorithm
How it works
- You write an
.amlfile, in VS Code or any text editor. - The checker reads it and reports errors with a clear message: an undeclared variable, a
REALstored in anINT, a function that never returns. - The generator writes the program in the language named on the
languageline of the file. - 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.