nuBASIC is a modern, open-source BASIC interpreter written in modern C++, available for Windows, Linux, and macOS. It is designed to be both approachable for beginners and capable enough for real programs.
- Structured programming —
Sub,Function,For,While,Do…Loop While,If/ElIf/Else,Select Case;Callkeyword;ByRef/ByValparameter passing; open-ended array parameters (param() As Type);Include/#Includefor multi-file programs - Classes with static methods —
Class/End Classwith instance fields, instance methods (Me), andStatic Function/Static Subcallable asClassName.Method()without an instance main()entry point — if aFunction main(...)is defined, execution starts there; CLI arguments are available viaargcandargv() As String- Namespaced modules —
Syntax Modernactivates qualified names (math::sin,string::left$);Using Moduleimports a module for unqualified access;Syntax Legacyrestores classic mode - Rich type system — Integer, Double, Boolean, Long64, String, Byte, Any, user-defined
Struct - Arrays and hash tables built into the language
- Full file I/O — sequential, binary, and random access
- Graphics — lines, rectangles, ellipses, filled shapes, text, bitmaps, pixel access (Windows GDI / Linux X11)
- Screen mode switching —
Screen 0(text/headless) /Screen 1(GDI graphics), like GW-BASICSCREEN;-tCLI flag for CI/scripting - Flicker-free rendering —
ScreenLock/ScreenUnlock/Refreshfor double-buffered animation - Mouse and keyboard input —
GetMouse()returns aMousestruct (x,y,btn) in one call - Date/time —
GetDateTime()returns aDateTimestruct with all fields in one call - UTF-8 string literals and console output
- Built-in help —
Help <keyword>andApropos <topic>accessible from the REPL - IDE for Windows and Linux (GTK+2) with syntax highlighting, auto-completion, and integrated debugger
- Console build for headless/embedded systems (no graphics, no external dependencies)
- MIT License
- Wiki — full language reference, graphics API, IDE guide, interpreter internals, and build instructions
- User Guide — complete guide in a single document (v2.0)
- Examples — ready-to-run
.basprograms covering games, graphics, fractals, animations, and more
# Interactive REPL
nubasic
# Run a program file
nubasic myprogram.basPrint "Hello, world!"nuBASIC builds with CMake 3.14+ and a C++20 compiler.
Windows (Visual Studio 2022):
git clone https://github.com/eantcal/nubasic.git
cd nubasic
mkdir build && cd build
cmake -G "Visual Studio 17 2022" ..
cmake --build . --config ReleaseLinux:
git clone https://github.com/eantcal/nubasic.git
cd nubasic
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make installConsole build (no graphics, no IDE):
cmake .. -DWITH_X11=OFF -DWITH_IDE=OFF
make -j$(nproc)See the Building from Source wiki page for full details including macOS, iOS/iSH, CMake options, and installer creation.
Tests live in the tests/ directory as test_*.bas files. They use
Screen 0 (text mode) so output goes to stdout without needing a GUI.
Windows (PowerShell):
.\tests\run_tests.ps1 -Interpreter .\build\release\Release\nubasic.exeFrom Visual Studio: right-click the RunTests target → Build.
Linux / macOS (Bash):
./tests/run_tests.sh --interpreter ./build/release/nubasicOr via CMake:
cmake --build build/release --target RunTests| Platform | Interpreter | IDE |
|---|---|---|
| Windows | nubasic.exe |
NuBasicIDE.exe (GDI console + Scintilla editor) |
| Linux | nubasic |
nubasicide (GTK+2 + Scintilla editor) |
| macOS | nubasic |
— |
| iOS (iSH) | nubasic (console build) |
— |
nuBASIC is open source under the MIT License.
Bug reports and feature requests: [email protected]
