Repository navigation
jdBasic 1.1
Superseded by jdBasic 1.2. These downloads stay for reference; new downloads are on 1.2.
jdBasic 1.1 - a modern BASIC built on a bytecode VM, with APL-style array
programming, native compilation, SDL3 graphics, a game layer, a local AI stack,
and a built-in MCP server that lets any AI agent drive a persistent VM:
run code, compile it to a standalone EXE, and even pause a running program to
live-tweak it and resume.
New here? Try it in the browser first (no download): https://jdbasic.org/live/index.html
Learn it: the Train jdBasic video series - https://www.youtube.com/playlist?list=PLowaSH4O3MGq-veO7qSIp-9EntEjY_iPZ
Refreshed on 25 October (Builds 106 to 110)
The 1.1 downloads were rebuilt from the current source. Same version; the compiled programs got much faster at array math and stopped leaking, and a few new subsystems came in.
Compiled array math runs on every core. A program built with -c now does its matrix work in its own runtime instead of boxing every cell into VM values:
MATMULandMATMUL_Trun on Eigen inside the compiled program, and a product big enough is cut into row bands, one per core.- Element-wise work on arrays of numbers skips the generic shape walk and builds large answers in row bands across the cores. That covers
+ - * / MOD ^, the comparisons, a number on either side, a matrix against a row, andTANH,EXP,SINand the other unary math builtins. RESHAPE,ROTATE,SHIFTandSLICErun natively as well.- The rows of a matrix no longer cost a bookkeeping entry each until something actually holds one.
Measured on a 25600 x 32 matrix, compiled, before and after:
| before | now | |
|---|---|---|
MATMUL by 32 x 32 |
57.7 ms | 10.3 ms |
TANH of the matrix |
21 ms | 6.3 ms |
x * x |
17.6 ms | 5.4 ms |
RESHAPE of a flat array into it |
52 ms | 5.2 ms |
column sums via MATMUL(ones, x) |
21.7 ms | 1.7 ms |
A 200-car reinforcement-learning port written in plain jdBasic (its own small autograd) went from 1.45 s to 0.85 s per training iteration.
Compiled programs free what they no longer hold. Arrays and maps are counted and freed once no variable, parameter, cell or FOR EACH holds them. That includes array literals, temporaries of operators and builtins, SPLIT answers, event arguments, and texts inside arrays. So x = a * a, x = MATMUL(x, m) or PUSH(list, [i, i + 1]) in a loop runs flat instead of growing. SYS.HEAP() answers the bytes the C heap holds, in both backends.
New
- Numerics:
MATMUL_T,BMM,SOLVEandINVERT, on Eigen. A reducer with an axis (SUM(t, 1)) works on 3-D and n-D arrays in both backends. - One broadcasting rule for both backends. Equal shapes meet cell by cell, a flat array meets every row of a matrix (
[N,k] op [k]), and a single cell meets everything.IIFover an array condition picks cell by cell into the rows of a matrix. - The Node Bus.
NODE.JOIN, topics, calls and inboxes between programs: on one machine over local sockets, across the LAN with thelanscope (multicast discovery, links proven with HMAC-SHA256).NODE.PACK$/NODE.UNPACKis the binary encoding it uses. The MCP server lists nodes and peeks at topics (jdb_nodes,jdb_peek). - Processes:
OS.SPAWNstarts a program and returns at once.OS.WAIT,OS.ALIVE,OS.KILL,OS.PIDandOS.SELF$go with it, andOS.LOADreports the CPU load on Windows, Linux and macOS. DECLARE FUNCtakesDOUBLEparameters and answers aDOUBLE, and anARRAYparameter hands a flat array of numbers to the function as a buffer that comes back filled.CSVWRITERtakes the number of significant digits as a fifth argument; 17 reads back the very same double.- Sound:
SOUND.LIMITERandSOUND.LOUDNESS(EBU R128 LUFS);SOUND.SEEK,SOUND.MUTE,SOUND.LEVELSandSOUND.CLOCKfor live mixing and for a show that follows the music in a second process;songgengained a live mixing desk and more genres.
- Module library, now 56:
RASTERrenders SVG to PNG without a window, so a chart fromSVGbecomes an image file headless. All 56 module self tests pass interpreted and compiled.
Fixed (selection)
- Compiled:
NONEprints asNONE,STR$of a date gives the date text,MAP.EXISTSanswers a boolean.RANGEstops before its end in either direction.- A named
FORMAT$placeholder picks its argument. NOWandNOW_EPOCHcarry fractions of a second.- A string
FUNCanswers a string, and aFOR EACHrow handed to aFUNCarrives as the array it is. - A
FUNCpassed by name toSELECTreads matrix rows correctly.
JSON.STRINGIFY$writes numbers with a dot whatever localeSETLOCALEchose.- An
ASYNC FUNCstarts from a copy of the globals at the call. - A
TRYblock left byEXITFOR,EXITDOorRETURNstops catching. - The base64 encoders and decoders no longer overflow a signed shift.
OS.SPAWNoutput files are writable by MSYS programs.GUI.TOOLTIPshows only while its item is hovered.- One shared core for dates,
FORMAT$, number text, strings, regex, paths andPACK$. The interpreter and compiled programs now run the same code there, instead of two copies that could drift apart.
Every pack was built from commit 171591ae. The gate (four suites, interpreted and compiled) passes on Windows, both Linux machines and the Mac. The 56 module self tests (6631 assertions interpreted, 6576 compiled) pass on Windows, and the full parity sweep shows no interpreter/compiler gap.
Refreshed on 17 October (Builds 101 to 105)
The 1.1 downloads were rebuilt from the current source. Same version, more in it, three bugs fewer:
- A live-coding sequencer.
SOUND.SEQtakes Strudel-style mini-notation (<a b>,a*4,a(3,8),~,[a,b],a?,_) with transforms such asarp,jux,off,every,iter,swingBy, per-eventgain/legato/pan, a built-in synthesized drum kit with choke groups, a resonant filter with envelope,SOUND.MODsweeps locked to the bar, sidechain, and four effect orbits with reverb and delay each. SOUND.AT cyclequeues the commands that follow for a bar; the mixer applies them on that bar's exact frame, so a whole arrangement is sent before the first note.SOUND.RECORD path$writes the mixer output to a WAV, live or offline inPULLmode.GFX.BLEND(NONE,BLEND,ADD) for glow and transparency;GFX.SAVE_SCREENSHOTwrites JPEG for a.jpgname.- Fixed: a compiled graphics program that ended with its window open aborted on exit; a
FORloop at the top level of a module did not count the variable its body read; a pattern scheduled for a bar could lose its downbeat at tempos whose bar is no whole number of samples. - Demos:
jdb/demos/sound/holds six five-minute tracks (synthwave, nu-disco, deep house, acid techno, trance, drum and bass) written as scores, with a fullscreen show around them, andrun_party.batplays them in a loop. In the browser playground they are undermusic/, the Train jdBasic lesson samples underlessons/.
New in 1.1
The compiler caught up with the interpreter. jdbasic -c is the half no
interpreter run can speak for, and that is where most of this release went:
- COM automation compiles.
CREATEOBJECTand property access on Excel,
Word and Outlook work in a standalone EXE, not only interpreted. - A lambda carries its captures.
LAMBDA USE(...)inside a function now
answers a closure holding a copy of every captured value, so the documented
MakeAddercompiles, two closures of one lambda hold different values, and
nesting works. Before, only a single lambda handed straight toSELECTor
FILTERcould be live at a time. - A date is a date. Compiled, a date is epoch seconds tagged as a date,
the way the VM holds it.TYPEOF,ISNUM,ISSTR,WEEKDAYand date
subtraction answer what they answer interpreted; before, a date passed on
through a variable read back as a string andWEEKDAYalways said 3. - An event handler can answer. A compiled form can refuse to close:
UNLOADsettingcanceltravels back to the raiser, and every other field
with it.forms_events_testreads 9 of 9 compiled, as it does interpreted. ERLandSTACK$exist in a compiled program,FINALLYruns, and a
FUNCorSUBthat answers nothing answersNONEinstead of 0.- A builtin that can answer any kind brings the kind with it.
EVALand
JDB.GLOBAL_GETkeep strings, dates and arrays instead of flattening them
into a number. - A module write that was never declared is a compile error under
-cand
EXPLICIT, naming its line.
Ten more modules: fifty-five in all, 6678 assertions. lib/ holds
libraries written in jdBasic itself, the answer to "there is no pip". Each has
a page, a demo and a self test, most of them checked against the Python
package they stand in for. All fifty-five self tests are green interpreted and
compiled.
| Stands in for | ||
|---|---|---|
IMG new |
Pillow | PNG read and written in every bit depth, crop, resize, kernels, palettes, alpha compositing, pixel-exact against Pillow |
ARCHIVE new |
tarfile, gzip | tar in ustar, GNU and pax, gzip with several members, extraction that refuses paths leaving the target |
SEARCH new |
rank_bm25, Whoosh | full-text search: an inverted index, BM25 ranking, phrase queries, typo tolerance, did-you-mean |
POOL new |
concurrent.futures, asyncio | worker pools over ASYNC: results in input order, per-job timeouts, cancellation, a shared rate limiter |
STRUCT new |
struct, construct | binary records declared once: nested layouts, bit fields, magic values, read into a map and written back |
RAND new |
numpy.random | seeded generators: ten distributions, weighted choice, sampling, the same draws in both backends |
I18N new |
gettext, babel | texts per locale with a fallback chain, CLDR plural rules, Accept-Language negotiation for JDWEB |
METRICS new |
prometheus_client | counters, gauges and histograms, the Prometheus text format byte for byte, JDWEB middleware |
PPTX new |
python-pptx | PowerPoint written: title slides, bullets, pictures, tables, speaker notes; slides read back |
TTF new |
fontTools | TrueType read for layout and embedding: metrics, glyph advances, the character map |
TESTKIT |
pytest | assertions, suites, TAP and JUnit, non-zero exit |
PROPTEST |
hypothesis | property based tests with shrinking |
CLI |
argparse, click | flags, options, subcommands, generated help |
PKG |
pip | modules installed by semver range, lock files |
REQ |
requests | sessions, auth, cookies, JSON and form bodies, uploads |
OAUTH |
authlib | client credentials, code flow with PKCE, device code, refresh |
JDWEB |
Flask | routes, middleware, sessions with expiry, CSRF, flash messages, a test client |
TMPL |
Jinja2 | HTML templates with layouts, loops and filters |
SECRET |
passlib, secrets | PBKDF2 password hashes, constant-time compare, tokens, API keys |
JWT |
PyJWT | HS256 sign, decode, verify |
MAIL |
smtplib, email | messages with attachments, sent over SMTP, read back |
LLMAPI |
openai, anthropic | one chat client for four back ends, tools, token usage |
SCHED |
croniter, APScheduler | cron expressions and a job loop |
RETRY |
tenacity | a call made again with a growing wait |
CACHE |
functools.lru_cache | a computed read answered once, with a size limit and a lifetime |
LOGGER |
logging | levels, console, file and JSON lines sinks, rotation |
CONF |
python-dotenv, tomllib | dotenv, INI and a TOML subset into one map shape |
SCHEMA |
pydantic | map validation with formats, and JSON Schema for structured LLM answers |
DF |
pandas | data frames: CSV, filters, group by, joins, pivots |
DB |
SQLAlchemy Core | SQLite through a query builder with bound values, migrations |
XLSX |
openpyxl | workbooks written and read without Excel, a workbook edited in place, cells painted |
DOCX |
python-docx | Word files written, templates filled, paragraphs read, code, notes, images and a table of contents |
PDFGEN |
fpdf2 | invoices and reports as PDF: TrueType fonts, PNG, links, bookmarks, turned text |
XML |
lxml | a tree with namespaces and XPath paths, written back |
YAML |
PyYAML | the block subset: read a compose file, change it, write it back |
HTMLDOM |
beautifulsoup | HTML as served into a tree, with CSS selectors |
MD |
markdown | the CommonMark subset to HTML |
ICAL |
icalendar | .ics calendars and recurrence rules |
SVG |
svgwrite, pygal | drawings and charts without a window: histogram, area, box, log scales, fitted curves |
QR |
segno | QR codes and the EPC payment code (GiroCode), equal to segno module for module |
CONSOLE |
tabulate, rich, tqdm | tables, styled text, rules, panels, progress bars |
TEXTX |
textwrap, slugify, humanize | wrap, slugs, transliteration, numbers in words |
TEXTDIFF |
difflib | line and word diffs, patches, snapshots |
FUZZY |
rapidfuzz | near matches and names that sound alike |
PARSEC |
pyparsing, lark | parser combinators and PEG grammars |
URL |
urllib.parse | the parts of an address, query strings, resolution |
MONEY |
decimal | exact money in minor units: rates, rounding modes, allocation |
VALID |
python-stdnum, pycountry | IBAN, BIC, EU VAT ids, EAN, ISBN, ISO 4217 and 3166 |
NUMFMT |
babel, num2words | numbers and money per locale, amounts in words |
DT |
dateutil, arrow | parsing, offsets, calendar arithmetic, relative text |
STATS |
scipy.stats | description, regression, significance tests, distributions |
FIT |
numpy, scipy.optimize | least squares, curve fits with errors, splines, roots |
ML |
scikit-learn | scaling, linear and logistic models, knn, k-means, trees, metrics |
GRAPH |
networkx | traversal, components, cycles, topological order, Dijkstra, A star |
FAKE |
Faker | made up names, addresses, IBANs and text, the same on every machine |
IMPORT QR and it is there. lib/README.md is the index; the reference has
the table under "The module library".
New in the language and the builtins
FOR EACH k, v IN mapandFOR EACH i, x IN arrwalk a snapshot, so the
body may write into what it reads.CODEC.DEFLATE$/CODEC.INFLATE$(raw, zlib and gzip) and
CODEC.CRC32;ZIP.WRITEdeflates every entry that shrinks. Python's
zlib,gzipandzipfileread the output at every level.PACK$andUNPACKgained signed codes, fixed strings, pad bytes and
repeat counts, plusPACKSIZE. A WAV header and a Modbus RTU frame match
Python'sstructbyte for byte.RNG.NEW/NEXT/INT/FILL: handle-based xoshiro256** generators,
the same sequences in both backends.CHAN.RECVtakes a timeout,CHAN.TRY_RECVnever blocks,CHAN.SELECT
names the first ready channel.FILE.MOVE,FILE.COPY,FILE.SET_MTIME, UTF-8 file names and local file
times;SYS.FREEDISKandSYS.DFfor the volume a path lies on.PATH.ABS$andPATH.ISABS; a leading(?i)in a regex means
case-insensitive instead of matching as literal text;INSTRraises when
the arguments arrive in the other dialect's order instead of quietly
answering 0.INPUT_HIDDEN$reads a line the terminal does not show.JSON.PARSEworks without the dollar sign, andPDF.TEXT$reads a page set
in an embedded TrueType subset through the font's own character map.- In the REPL, a line starting with
?runs asPRINT.
One breaking change. The bare constants PI and E are gone:
write MATH.PI and MATH.E (both also read as MATH.PI() and MATH.E()).
E collided with the parameter name every forms event handler uses, which
-c then refused to declare. All 132 reads in the repository were rewritten
from the lexer's token positions, so strings, comments and variables named
pi or e were left alone.
The VB6 pack compiles a forms program to an .exe. It is the one bundle
that now carries FORMS and the native toolchain together, with jdbrt.dll,
jdbrt.lib, jdb_runtime.obj and LLVM-C.dll alongside. All four shipped
forms demos compile with -c and run; -c copies the runtime DLL and the
font next to the produced EXE itself. Compiling needs Visual Studio 2022
17.10 or newer on the machine (the MSVC linker provides a symbol the runtime
object references); running a compiled EXE needs nothing installed.
Every test suite runs on every push. CI builds on Windows and Linux and
puts all 24 gate suites through the interpreter on both, then builds a third
time with the LLVM backend and puts the same 24 through -c. A suite has to
print its marker and exit 0 to count.
Downloads (Windows x64, Builds 106 to 109; Linux and macOS below)
Every bundle ships the app-local Visual C++ runtime, so it runs on a clean
Windows with no redistributable installed. Each also ships the full help.txt
reference (HELP in the REPL), doc/languages.md, the module library lib/,
curated examples and THIRD_PARTY_LICENSES.txt.
| Bundle | Size | What you get |
|---|---|---|
jdbasic-core-windows-x64.zip |
~4.9 MB, Build 106 | Interpreter + MCP server, no LLVM. Smallest footprint. |
jdbasic-mcp-native-windows-x64.zip |
~35.6 MB, Build 107 | Core plus the LLVM native-compile toolchain for jdbasic -c (standalone EXEs). |
jdbasic-vibe-game-pack-windows-x64.zip |
~8.7 MB, Build 108 | GFX/ImGui build with ready-to-run game demos, launchers, and an AI pair-coding quickstart. Embedded SQLite (SQL.*) for highscores and save state, plus WAV I/O and the effects chain (WAV.*, FX.*). |
jdbasic-vb6-windows-x64.zip |
~37.2 MB, Build 109 | VB6 Pack: native Win32 forms (FORM.*), COM automation (Excel/Word/Outlook via CREATEOBJECT), embedded SQLite (SQL.*), GFX/ImGui/HTTP, the MCP server and the native compiler, so a forms program becomes an .exe. Ships forms demos incl. .jdform layouts from the VS Code visual designer. |
SHA256
jdbasic-core-windows-x64.zip B071F55AF6D45D214D1581A17CECA4B917AF67CA3B12896AE9DA24F6C75C22B8
jdbasic-mcp-native-windows-x64.zip 1DAE68B95BF95785864813C0BDEB0536633405C5AFD1D43052346E809AA3B786
jdbasic-vibe-game-pack-windows-x64.zip 65A3EF84B107008DCF9153150FBF563F0C427A6F6B931B6AE62F1162550EE270
jdbasic-vb6-windows-x64.zip 2D0C350AB4AB1351606FD064594B1774BD595FC8BE7F483EF51541945D8A8597
Verify with PowerShell: Get-FileHash -Algorithm SHA256 <file>.zip.
First run on Windows. The binaries are Authenticode-signed (certificate:
Open Source Developer Achim Christ). Because the signature is new, Microsoft
Defender SmartScreen may show a "Windows protected your PC - unrecognised app"
notice the first time you start jdBasic.exe. This is a reputation prompt,
not a malware detection - the signed publisher is shown right in the dialog.
Click "More info" if the button is hidden, then "Run anyway". To skip it
entirely, right-click the downloaded .zip before extracting, choose
Properties, tick Unblock, and click OK - then no extracted file carries the
"downloaded from the internet" mark.
Linux and macOS (Build 110)
Three tarballs, each a directory you unpack anywhere and run from: jdbasic
(the interpreter and MCP server), libjdbrt.so beside it, jdb_runtime.o for
the native compiler, help.txt, a README.txt, doc/ and the whole
fifty-six-module lib/.
| Tarball | Size | Built on |
|---|---|---|
jdbasic-linux-x64.tar.gz |
~9.9 MB | Ubuntu 24.04 LTS, GCC 13.3, generic x86_64 |
jdbasic-linux-x64-cortex.tar.gz |
~10.0 MB | Ubuntu 25.10, GCC 15.2, generic x86_64 |
jdbasic-macos-arm64.tar.gz |
~7.9 MB | macOS 15.6, Apple Silicon, clang + LLVM 18 |
The two Linux tarballs are the same program built by two different compilers
on two different distributions, for coverage. Take either.
tar -xzf jdbasic-linux-x64.tar.gz
cd jdbasic-linux-x64
./jdbasic # the REPL
./jdbasic hello.jdb # run a program
./jdbasic -c hello.jdb # compile it, then ./hello.exe
Nothing has to be set: the binary finds its runtime beside itself and a
compiled program carries the same path, so it runs from any directory.
IMPORT DF and the rest of the library work out of the box, and
JDBASIC_PATH=<dir>/lib points a program elsewhere at it. These builds leave
out SQLite, so DB and the jdweb sign-in need a build with SQLITE=1.
No OpenSSL is bundled. Both platforms link the system libssl and
libcrypto, which every current distribution and Homebrew already have.
Only the Windows core bundle ships those DLLs.
These are not code-signed. The certificate is Windows-only, so macOS
puts a downloaded tarball in quarantine and refuses to start the binary.
Clear it once after unpacking:
xattr -dr com.apple.quarantine jdbasic-macos-arm64
SHA256
jdbasic-linux-x64.tar.gz ba2c8448f1de1cd9593b8f743e786dcc38035870b4c3feee4bf5be9b99b7a713
jdbasic-linux-x64-cortex.tar.gz bca8018a733011d1745bcda578d6017aed706db2e6ba151974163881ff3c83c3
jdbasic-macos-arm64.tar.gz d8c8d09028a8f2cfd524cbf048e97c340c363a1df1ce444bea07e898f64634bc
Verify with sha256sum <file> on Linux, shasum -a 256 <file> on macOS.
The gate passes interpreted and through -c on all three machines, and all
56 module self tests are green on Windows in both backends. Each tarball was
unpacked into an empty directory on its own machine, then ran a program, an
IMPORT and a -c compile from there before it was uploaded.
Use it as an MCP server
{
"mcpServers": {
"jdbasic": { "command": "C:\path\to\jdBasic.exe", "args": ["--mcp"] }
}
}Full client config and the tool reference are in doc/MCP.md, which also ships inside every bundle.
Language reference: doc/languages.md - Source and issues: https://github.com/AtomiJD/jdBasic