← Dolaima← Docs index27 languages原文中文

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.

LanguageIn one line
CThe 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-CThe syntax is a superset of C, and the UI interfaces are used exactly as in C.
JavaClose to desktop Java; external functions are declared native.
KotlinThe same approach as Java, with shorter syntax.
SwiftNatural to write, and the plane shooter example is a complete, playable game.
GoClose to desktop Go; the snake example is a complete game.
RustUsable, but do not expect the full standard library.
DC-style syntax, a little more relaxed than C to write.
DartClose in style; external functions are declared external.
PythonThe fastest one to write. The syntax is almost desktop Python, and changing a line and running again is a pleasure.
JavaScriptClose in style, but you have to call the entry point yourself.
LuaA light, quick little language: pleasant for small games, and it compiles fast.
RubyUsable, but this front end supports the fewest features of all: write everything flat.
RA vector language, close to desktop R in style.
PascalClearly structured; well suited to writing game state machines.
FortranThe scientific-computing style works here too.
BASICThe old-fashioned style: imperative, one line after another.
ForthA stack language; writing in it is a completely different way of thinking.
SchemeA Lisp dialect where brackets are everything.
AdaStatically typed, with a Pascal-like skeleton but its own syntax (is ... begin ... end, procedure / function, loop ... exit when, 1-based arrays).
COBOLBoth 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.
dBasexBase-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.
PerlThe "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.
PHPA 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).
LadderA 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.)