jdBasic: A modern BASIC interpreter with APL-style array processing and a built-in Tensor engine for building and training neural networks from scratch.
Whether you're looking to relive the nostalgia of 8-bit coding with modern conveniences or explore powerful data processing paradigms in a simple syntax, jdBasic offers a unique and powerful environment. The language is designed to be easy to learn but capable enough to build complex, modular applications.
jdBasic is packed with features that bridge the gap between retro and modern programming:
- Familiar control flow with
FOR...NEXTloops,GOTO, and labels. - Multi-line
IF...THEN...ELSE...ENDIFblocks for conditional logic. - Robust error handling with
TRY...CATCH...FINALLYblocks.
-
N-Dimensional Arrays: First-class support for vectors, matrices, and higher-dimension arrays.
-
Element-Wise Operations: Perform arithmetic on entire arrays at once (e.g.,
My_Array * 2 + 5). Most built-in functions (SIN,SQR,RIGHT$, etc.) are vectorized and apply to every element automatically.- Data Analysis & Reduction: Instantly aggregate arrays with
SUM,PRODUCT,MIN,MAX, and perform cumulative operations withSCAN.
- Data Analysis & Reduction: Instantly aggregate arrays with
- Modular Programming: Organize your code into reusable modules with
IMPORT. - Rich Data Types: Full support for
Date/Timeobjects,Maps, and user-definedTYPEs. - Cross-Platform: Run your code on both Windows and Linux.
- Library Integration: Connect to external libraries for databases (
SQLite) and machine learning (TensorFlow).
- First-Class Functions: Treat functions as values. Assign them to variables and pass them to other functions using the
@handle. - Higher-Order Functions: Use powerful functions like
SELECT(map) andFILTERthat take other functions as arguments. - Lambda Functions: Define anonymous, inline functions for concise data manipulation (e.g.,
lambda i -> i * 2). - Pipe Operator (
|>): Chain function calls together into elegant, readable data pipelines.
Read the language reference: https://github.com/AtomiJD/jdBasic/blob/development/doc/languages.md
Read the manual: https://github.com/AtomiJD/jdBasic/blob/development/doc/manual.md
Get the latest release at: https://github.com/AtomiJD/jdBasic/releases/tag/jdbasic Download: release.zip Extract it wherever you want. Open a command window and change your directory to the "jdb" folder.
To run a jdBasic program, simply pass the source file to the interpreter from your command line:
..\bin\jdBasic test.jdbBuild from code: https://github.com/AtomiJD/jdBasic/blob/development/doc/build_linux_macos.md
If you want to code in vs code take a look at: https://github.com/AtomiJD/jdBasic/blob/development/vscode_extension/vscode_readme.md
This is where jdBasic truly shines. You can combine higher-order functions (SELECT, FILTER), anonymous lambda functions, and the pipe operator (|>) to create powerful and declarative data processing pipelines.
' --- Functional Pipeline Example ---
' Start with a sequence of numbers from 1 to 10
numbers = IOTA(10)
PRINT "Original numbers: "; numbers
' This pipeline:
' 1. Filters the numbers to keep only those greater than 5
' 2. Multiplies each of the remaining numbers by 10
' The '?' in the pipe sequence is a placeholder for the result of the previous step.
result = numbers |> FILTER(lambda val -> val > 5, ?) |> SELECT(lambda v -> v * 10, ?)
PRINT "Result: "; result
' Expected Output: [60 70 80 90 100]Define your own data structures using TYPE, which can contain methods (FUNC or SUB). This allows for an object-oriented style of programming.
' --- RPG Player TYPE Example ---
TYPE Player
Name AS STRING
Health AS INTEGER
MaxHealth AS INTEGER
AttackPower AS INTEGER
' Method to take damage
SUB TakeDamage(damage)
' 'THIS' refers to the current object instance
THIS.Health = THIS.Health - damage
IF THIS.Health < 0 THEN THIS.Health = 0
PRINT THIS.Name; " takes "; damage; " damage! Health is now "; THIS.Health
ENDSUB
' Method to check if the player is defeated
FUNC IsDefeated()
RETURN THIS.Health <= 0
ENDFUNC
' Method to display status
SUB ShowStatus()
PRINT "--- Player: "; THIS.Name; " ---"
PRINT " Health: "; THIS.Health; " / "; THIS.MaxHealth
PRINT " Attack: "; THIS.AttackPower
ENDSUB
ENDTYPE
' Create a player instance
DIM Hero AS Player
Hero.Name = "Arion"
Hero.Health = 100
Hero.MaxHealth = 100
Hero.AttackPower = 15
' Create an enemy
DIM Goblin AS Player
Goblin.Name = "Goblin"
Goblin.Health = 30
Goblin.MaxHealth = 30
Goblin.AttackPower = 5
Hero.ShowStatus()
Goblin.ShowStatus()
PRINT
PRINT "A wild Goblin appears! Battle starts!"
Goblin.TakeDamage(Hero.AttackPower) ' Hero attacks Goblin
IF NOT Goblin.IsDefeated() THEN
Hero.TakeDamage(Goblin.AttackPower) ' Goblin attacks Hero
ENDIF
IF Goblin.IsDefeated() THEN
PRINT Goblin.Name; " has been defeated!"
ENDIFjdBasic is an active project with many recent additions and exciting plans.
- Cross-Platform Support: jdBasic is now available for both Windows and Linux!
- Robust Error Handling: The
TRY...CATCH...FINALLYstructure is fully implemented for writing safer, more resilient code. - Advanced Array Operations: Powerful APL functions like
SCAN(cumulative reduce) andROTATE(cyclical shift) have been added. - Library Integrations: jdBasic can now interface with external libraries, with modules for
SQLiteandTensorFlowalready available.
- Enhanced Game Development: Major improvements are planned for the
SPRITEandMAPlibraries to make game creation easier and more powerful. - GUI Toolkit Integration: We are exploring the integration of a GUI library to enable the creation of applications with native graphical user interfaces.
- Improved Linux Build: The Linux version will be enhanced with libraries like SDL3 for better graphics and hardware support.
Contributions and feedback are welcome!

