This is a modern version of the historic ALTAIR BASIC programming language originally created by Bill Gates and Paul Allen in 1975. This interpreter lets you write and run programs in the classic BASIC language on your modern computer - now debugged and ready to transport you back to 1975 (thankfully without the bell-bottoms).
BASIC (Beginner's All-purpose Symbolic Instruction Code) is a simple programming language designed for beginners. It was one of the first programming languages widely available for personal computers and helped introduce a generation to computer programming. Think of it as JavaScript's great-grandparent, just with more line numbers and fewer callback functions.
-
Download the Interpreter:
- Windows: Download
altair-basic-windows.zipfrom the Releases page - Mac: Download
altair-basic-mac.zipfrom the Releases page - Linux: Download
altair-basic-linux.zipfrom the Releases page
- Windows: Download
-
Install:
- Windows: Extract the ZIP file to any folder
- Mac: Extract the ZIP file and move to Applications
- Linux: Extract the ZIP file to a folder of your choice
-
Run the Interpreter:
- Windows: Double-click on
basic.exe - Mac: Double-click on
basic.app - Linux: Open terminal, navigate to the folder, and type
./basic
- Windows: Double-click on
If you're comfortable with development tools, you can build the interpreter from source:
- C++17 compatible compiler (GCC, Clang, MSVC)
- CMake 3.10 or higher
On Unix-like systems (Linux, macOS):
./build.shOn Windows:
mkdir build
cd build
cmake ..
cmake --build .When you start the program, you'll see a welcome screen and a Ready> prompt where you can type commands.
RUN- Run your programLIST- Show your current programNEW- Start a new program (erases current program)LOAD filename- Load a program from a fileSAVE filename- Save your program to a fileHELP- Display help informationEXITorQUIT- Exit the interpreter
To create a program, type lines starting with line numbers:
10 PRINT "HELLO WORLD"
20 PRINT "MY NAME IS BASIC"
30 ENDThen type RUN to execute your program.
The examples folder contains several sample programs you can try:
hello.bas- Simple "Hello, World!" programfactorial.bas- Calculates factorial of a numberarrays.bas- Demonstrates array usagefunction_test.bas- Shows built-in functions
To run an example:
LOAD examples/hello.bas
RUN
- Every line must start with a line number (1-9999)
- Lines are executed in order of line numbers
- The program ends when it reaches an
ENDstatement or the last line
PRINT- Displays text or valuesLET- Assigns a value to a variableINPUT- Gets input from the userREM- Adds a comment (ignored when running)GOTO- Jumps to a specific line numberIF...THEN- Conditional executionFOR...NEXT- Repeating code a specific number of timesGOSUB...RETURN- Calls a subroutine
- Numeric variables: A-Z, A0-Z9 (e.g., A, B1, X2)
- String variables: A$-Z$ (e.g., A$, N$)
10 REM This is a simple program
20 PRINT "PLEASE ENTER YOUR NAME"
30 INPUT N$
40 PRINT "HELLO, "; N$
50 PRINT "PLEASE ENTER A NUMBER"
60 INPUT X
70 LET Y = X * 2
80 PRINT X; " TIMES 2 IS "; Y
90 ENDSQR(X)- Square rootABS(X)- Absolute valueINT(X)- Integer partSIN(X),COS(X),TAN(X)- Trigonometric functionsRND(X)- Random number
LEN(X$)- Length of a stringLEFT$(X$, N)- Leftmost N charactersRIGHT$(X$, N)- Rightmost N charactersMID$(X$, S, N)- N characters starting at position S
This implementation is based on the ALTAIR BASIC interpreter from 1975. It was the first product created by Microsoft (then called "Micro-Soft") and marked the beginning of what would become one of the world's largest technology companies.
If you encounter issues or have suggestions, please open an issue on our GitHub repository. We welcome your feedback and contributions.
- ✅ Core language features
- ✅ Math functions
- ✅ String handling
- ✅ User-defined functions (sort of - we're still debugging this!)
- ✅ Cross-platform support (Windows, macOS, Linux)
- ✅ Fixed type compatibility between
Value::Exprandbasic::Expr(the bug that almost broke everything!)
We bravely dove into 1975-era BASIC to fix some issues that would make even Bill Gates scratch his head:
- Fixed nasty type compatibility issues between
Value::Exprandbasic::Exprclasses - Made both types play nicely together with some C++ type aliasing wizardry
- Battled and defeated cryptic C++ template errors that looked like hieroglyphics
- Made FOR loops actually loop and GOTOs actually go to places
- Ensured subroutines come back home with RETURN statements
- Added simple test programs to prove it all works
Now you can relive the glory days of early computing without the hardware headaches! Bill Gates would be proud (or maybe horrified at what we've done to his code).
