The ZX BASIC Compiler

2008-06-07 20:06 by boriel

I finally did it!! The ZX Spectrum BASIC compiler really works! šŸ˜‰

Yes, my first home computer was the ZX Spectrum 48K—as you’ve probably already guessed—and it left a lasting impression on me.

As a child, one of my dreams was to write a compiler for this machine: to have the power to transform slow ZX Spectrum BASIC into Z80 machine code and to be able to develop games or other interesting programs without struggling with assembler language.

Years passed, my ZX Spectrum grew old and faded away… šŸ™ but that dream of creating my own Spectrum BASIC compiler never did. At first, it was due to my lack of knowledge (I later studied Computer Science at university), and later, it was because of a lack of time. But today, I’ve finally made it happen—and yes, I’m a little thrilled! 😊

If you’ve ever wanted your BASIC programs to run faster, I encourage you to give it a try.

Brief Information

If you’ve made it this far, you’re probably interested. Here’s what you need to know:

What is it exactly?

It’s an SDK entirely written in Python (using PLY as the LALR parser) that runs on your PC.

What does it do?

You write a program in a BASIC dialect using your preferred text editor, and this tool compiles it into ZX Spectrum (Z80) machine code.

Which platforms does it run on?

It runs on any platform that supports Python, including Linux, Windows, and macOS. All you need is the Python interpreter installed on your computer. For Windows users, there’s also an .MSI installer that bundles Python with the compiler, so you don’t need to install it separately.

How do I transfer the program to my Speccy?

There are several ways:

  • This tool lets you create .bin and .tzx files.
  • To test your program, you can use a ZX Spectrum emulator (there are tons of them available online).
  • You can also convert your TZX program to .MP3 or .WAV and record it onto a CD or cassette, just like the old days! šŸ˜‰

Where can I find out more?

Check out these two main resources:


Where can I ask for help?

You can ask for help on:


Where can I download it?

Visit the download page to get the latest version.


For more information, check out the FAQ section in the Wiki. I’ll be adding tutorials there soon.
The compiler is still evolving and expanding as I work toward my next goal…


Back to posts