27 languages
One VML interface set, usable from all 27 front ends. Write in whichever one you know - what you compile runs on the same virtual machine.
One page per language
Open any one of them and you get its language reference (syntax, types, standard library), what this front end supports, and the pitfalls we hit on real devices. The last two are taken straight from each compiler's README.md / <language>_LANGUAGE_SPEC.md in the VML source, so regenerating this page brings them up to date.
| Language | In one line |
|---|---|
| C | The most complete path: drawing, input, sound, save data and the gamepad are all available. The full games in this repo (Tetris, Gomoku, Pac-Man) are all written in C. |
| C++ | The same interfaces as C, with classes. Good for organising game logic into objects. |
| C# | Reads like desktop C#; the entry point is always a class named P. |
| Objective-C | The syntax is a superset of C, and the UI interfaces are used exactly as in C. |
| Java | Close to desktop Java; external functions are declared native. |
| Kotlin | The same approach as Java, with shorter syntax. |
| Swift | Natural to write, and the plane shooter example is a complete, playable game. |
| Go | Close to desktop Go; the snake example is a complete game. |
| Rust | Usable, but do not expect the full standard library. |
| D | C-style syntax, a little more relaxed than C to write. |
| Dart | Close in style; external functions are declared external. |
| Python | The fastest one to write. The syntax is almost desktop Python, and changing a line and running again is a pleasure. |
| JavaScript | Close in style, but you have to call the entry point yourself. |
| Lua | A light, quick little language: pleasant for small games, and it compiles fast. |
| Ruby | Usable, but this front end supports the fewest features of all: write everything flat. |
| R | A vector language, close to desktop R in style. |
| Pascal | Clearly structured; well suited to writing game state machines. |
| Fortran | The scientific-computing style works here too. |
| BASIC | The old-fashioned style: imperative, one line after another. |
| Forth | A stack language; writing in it is a completely different way of thinking. |
| Scheme | A Lisp dialect where brackets are everything. |
| Ada | Statically typed, with a Pascal-like skeleton but its own syntax (is ... begin ... end, procedure / function, loop ... exit when, 1-based arrays). |
| COBOL | Both source layouts are accepted (classic fixed format and free format, detected automatically). The execution model is COBOL's paragraphs and fall-through: the main flow CALLs each paragraph in order, and PERFORM is just a CALL. |
| dBase | xBase-family .prg (dBASE III/IV, FoxPro, Clipper style): IF / DO WHILE / FOR / DO CASE, PROCEDURE / FUNCTION / RETURN / DO ... WITH, plus a set of string and numeric builtins. |
| Perl | The "full arithmetic + control flow + function calls" tier: arrays (@a), hashes (%h), subroutines, string handling, loops and recursion all work - enough for something the size of a word-frequency counter. |
| PHP | A subset that can write a normal program: <?php ... ?> tags (text outside a tag is emitted verbatim as HTML, and with no opening tag at all the whole file is PHP), $variables, echo / print, the full set of arithmetic / comparison / logical / bitwise operators, if / while / do-while / for / foreach / switch, functions (default arguments, recursion, global) and subscripted arrays (both [] and array() literals). |
| Ladder | A ladder-diagram (PLC) style front end - it cannot build phone UI programs. |
Run one first
vml run examples/c/app/tetris.c # Tetris
vml run examples/python/app/tetris.py # the same game, Python version
vml run examples/c/app/gomoku.c # Gomoku
vml run examples/lua/app/life.lua # Game of Life
vml run examples/basic/app/whack.bas # Whack-a-mole
Most language folders also have a sysinfo.<ext> that calls ui_call_json("sysinfo", "") and prints your device information - if you want to know whether this language is usable, run that first. (Ada / COBOL / dBase / Perl / PHP do not have one yet; run their hello / fizzbuzz instead.)