A modern BASIC for developers who want to build without unnecessary friction — a real compiler to bytecode, with a runtime for 2D/3D graphics, physics, and networking.
You do not need this repository’s source code to use moonBASIC. Install from a pre-built archive, write .mb files, and run them. Everything below about folders like compiler/ or go build is optional and only for people hacking on the engine itself.
Pre-built binaries ship from github.com/CharmingBlaze/moonbasic/releases (Windows, Linux x64, macOS Apple Silicon). This repository is the engine source; end users normally download from the public repo above.
Optional static page (direct archive links): charmingblaze.github.io/moonbasic/
| Your goal | Download (replace <tag> with the release, e.g. v1.2.28) |
|---|---|
| moonBASIC IDE (editor + compiler + runtime + docs — easiest) | IDE bundle: moonbasic-<tag>-ide-windows-amd64.zip, moonbasic-<tag>-ide-linux-amd64.tar.gz, or moonbasic-<tag>-ide-macos-arm64.tar.gz |
| Run games (window, graphics, physics, audio) | Full runtime: moonbasic-<tag>-windows-amd64.zip, moonbasic-<tag>-linux-amd64.tar.gz, or moonbasic-<tag>-macos-arm64.tar.gz |
Compile .mb → .mbc, --check, --lsp only (CI, tooling, no game window) |
Compiler only: moonbasic-<tag>-compiler-windows-amd64.zip or moonbasic-<tag>-compiler-linux-amd64.tar.gz |
| VS Code (syntax + LSP + debugger) | moonbasic-<tag>-vscode.vsix — install from VSIX |
- IDE bundle includes
moonbasic-ide+moonbasic+moonrun(+README-IDE-RELEASE.txt). Extract and run START-IDE — documentation is built into the IDE. Best for beginners. - Full runtime includes
moonbasic+moonrun(+README-RELEASE.txt). Use this if you want to play or develop games from the terminal. - Compiler only is a small folder with
moonbasiconly (nomoonrun). Seedist/README.mdfor the full picture.
- Download
moonbasic-<tag>-ide-…from moonbasic releases. - Extract and run START-IDE (see
README-IDE-RELEASE.txtin the archive). - Open a
.mbfile — F5 run, Ctrl+Shift+C check, Alt+H help at cursor.
Use moonrun — one command to compile and play. The full-runtime archive includes both moonbasic (compiler/LSP) and moonrun (game engine). For your first window you only need moonrun.
New project: moonbasic new MyGame → cd MyGame → moonrun main.mb (creates main.mb, assets/, and VS Code debug config).
- Open a terminal in the folder that contains
moonrun(andmoonbasic) from the full runtime zip/tarball. - Check it works:
moonrun --version(Windows:moonrun.exe --version). - Run a game:
moonrun path/to/game.mb— compiles in-process if needed, then opens the engine window. - Optional — lint only:
moonbasic --check path/to/game.mb(no window). - Optional — compile to bytecode:
moonbasic path/to/game.mb→ writesgame.mbcnext to the source.
Compiler-only installs (CI/tooling) ship moonbasic without moonrun — use those for --check, --lsp, and .mbc output only; install the full runtime to run games with a window.
Release moonrun does not require Go, GCC, or Clang on your machine — it compiles .mb in-process, then runs the engine. You may still need a normal GPU stack (Linux) or the VC++ x64 redistributable on some Windows setups if a DLL is missing; see README-RELEASE.txt inside the full-runtime archive.
Editor: use the moonBASIC IDE download (recommended), or run moonbasic --lsp for other LSP clients. VS Code: download moonbasic-<tag>-vscode.vsix from moonbasic releases — quick steps. Contributors: DEVELOPER.md — moonBASIC in VS Code.
More detail on what each zip contains: dist/README.md · step-by-step install, first window, and how to ship your game to players: docs/GETTING_STARTED.md (section Ship your game)
Many engines impose their own complexity before you can begin creating. moonBASIC is intentionally direct: one toolchain, one mental model, and a workflow that values clarity and speed.
- Vertical integration — compiler, VM, and engine in one stack.
- 2D and 3D — same language and workflow for both.
- Real compilation — not an interpreter; bytecode executed by a production-oriented runtime (Raylib, Jolt 3D, Box2D 2D, ENet, … where enabled).
The compiler is stable; the standard library covers Tiled, materials, sprites, atlases, particles, audio, lighting, shaders, and more. Explore the documentation index and ARCHITECTURE.md when you want to go deeper.
Compact 3D sample (no # / $ / ? suffixes — implicit typing only):
WINDOW.OPEN(960, 540, "Spinning cube")
WINDOW.SETFPS(60)
cam = CAMERA.MAKE()
CAMERA.SETPOSITION(cam, 0, 2, 8)
CAMERA.SETTARGET(cam, 0, 0, 0)
CAMERA.SETFOV(cam, 45)
cube = MESH.MAKECUBE(2, 2, 2)
mat = MATERIAL.MAKEDEFAULT()
cubeXform = TRANSFORM.IDENTITY()
angle = 0
WHILE NOT (INPUT.KEYDOWN(KEY_ESCAPE) OR WINDOW.SHOULDCLOSE())
dt = TIME.DELTA()
angle = angle + 45 * dt
TRANSFORM.SETROTATION(cubeXform, 0, angle, 0)
RENDER.CLEAR(12, 14, 22)
CAMERA.BEGIN(cam)
MESH.DRAW(cube, mat, cubeXform)
CAMERA.END(cam)
RENDER.FRAME()
WEND
MESH.FREE(cube)
MATERIAL.FREE(mat)
TRANSFORM.FREE(cubeXform)
CAMERA.FREE(cam)
WINDOW.CLOSE()
Full sample with grid and text: examples/spin_cube
- Compilation produces bytecode with the
.mbcextension. - Execution is handled by the virtual machine, which talks to Raylib, Jolt, Box2D, ENet, and other systems through CGO where enabled in full runtime builds.
| Document | What it covers |
|---|---|
| docs/GETTING_STARTED.md | Install, first window, moonbasic new, debugging |
| docs/FIRST_HOUR.md | Friendly intro for beginners |
| docs/reference/MIGRATION.md | BlitzBASIC porting; compile-time stub list |
| docs/PROGRAMMING.md | Game loop, modules, 2D/3D |
| docs/LANGUAGE.md | Variables, control flow, functions, $"...", ENUM, multi-return |
| docs/ROADMAP.md | Language roadmap — shipped vs planned |
| docs/COMMANDS.md | Built-in command index |
| examples/README.md | Runnable sample programs |
| dist/README.md | Release artifacts explained |
More: docs/reference/, docs/reference/MULTIPLAYER.md (multiplayer hub), docs/JOLT_WINDOWS_PARITY.md (Windows Jolt / CGO notes for engine devs), ARCHITECTURE.md.
For contributors: repository layout
The GitHub file tree is for engine development. End users who only download Releases never need to open these paths.
| Path | Purpose |
|---|---|
cmd/moonbasic, cmd/moonrun |
CLI entrypoints (compiler vs full runtime). |
compiler/, vm/ |
Language front-end, bytecode, VM. |
runtime/ |
Engine modules (rendering, physics, audio, net, …). |
docs/ |
Guides and reference. |
examples/ |
Runnable projects. |
dist/ |
Packaging notes — see dist/README.md. |
scripts/, tools/ |
Release packaging and audit helpers. |
Build from source
Building from source requires Go and a C toolchain. Full graphical programs need the fullruntime build tag and moonrun (or moonbasic --run from a full-runtime build). See docs/BUILDING.md, CONTRIBUTING.md, and AGENTS.md.
git clone https://github.com/CharmingBlaze/moonbasic-compiler
cd moonbasic
# Windows (example): set CGO_ENABLED=1 and a working gcc, then:
go build -o moonbasic.exe .
# Run a 3D sample (full runtime + CGO):
CGO_ENABLED=1 go run -tags fullruntime ./cmd/moonrun examples/spin_cube/main.mbGuidelines: CONTRIBUTING.md and docs/DEVELOPER.md. CI validates builds, tests, and representative go run . --check samples.
On Windows, a fullruntime link that pulls in Jolt may require prebuilt libJolt.a and libjolt_wrapper.a in third_party/jolt-go/jolt/lib/windows_amd64/. scripts/check-jolt-windows-libs.ps1 checks that both files are present.
MIT — see LICENSE.
