SO Vault: Are there still BASIC compilers/interpreters that use line numbers?


Full article

StackOverflow sees quite a few threads deleted, usually for good reasons. Among the stinkers, though, lies the occasionally useful or otherwise interesting one, deleted by some pedantic nitpicker - so I resurrect them. πŸ‘»

Note: Because these threads are older, info may be outdated and links may be dead. Feel free to contact me, but I may not update them... this is an archive after all.

Are there still BASIC compilers/interpreters that use line numbers?

Question asked by Wim ten Brink on Sep 15, 2009

When I learned to program, (30 years ago) I was using a ZX-81 which used line numbers to label every line of code. The Sinclair QL I had next did support this too but also allowed the use of subroutines. The first GWBasic/ABasic interpreters also supported the use of line numbers instead of the "modern techniques" of the modern BASIC compilers.


10 IF X = 42 GOTO 40
20 X = X + 1
30 GOTO 10
40 PRINT "X is finally 42!"

Now, purely for some dumb nostalgic feeling that I want to feel by going back to my roots, I just wonder... Is there still some BASIC compiler or Interpreter that supports this (obsolete) line-numbering technique? One that is kept up-to-date with the more modern operating systems, that is...

(OS doesn't matter, although I would prefer for one that supports Windows Vista 64-bits.)

Answer by Alexandre Bell (Sep 15, 2009)

Use a text editor. Preferably also capable of code coloring that supports BASIC (Notepad++, for instance). That should be enough. These editors even throw support for external tools, so you can setup your build environment by running the compiler/interpreter from within the editor.

As for the other question:

Now, purely for some dumb nostalgic feeling that I want to feel by going back to my roots, I just wonder... Is there still some BASIC compiler or Interpreter that supports this (obsolete) line-numbering technique? One that is kept up-to-date with the more modern operating systems, that is...

Yes. But careful! ;) The line numbers on the left where never a part of the language. They existed only for convenience (especially because of the goto x statements). The interpreter didn't care about them, much like modern languages.

Anyways, you are looking for the most excellent BASin. Go to and search that page for BASin. The changelog can be seen at the author's blog. But the download is only available from World Of Spectrum


The line numbers on the left were used as GO TO targets, and were used in editing. The lines would automatically be sorted in line number order, and if you typed a line with the same line number as a previous one you'd overwrite the old one. They were an integral part of the language system. – David Thornley Sep 15 '09 at 20:04

those were editor features. Please do not downvote unless you have very specific knowledge of what you are talking about. The BASIC interpreter is well known and documented. Line numbers are internally generated. The editor line numbers are not used. – Alexandre Bell Sep 15 '09 at 21:01

I upvoted! I like those emulators!!! Even though these are just emulators of old systems while I would prefer a more modern compiler/interpreter. (Something that can handle modern amounts of memory.) – Wim ten Brink Sep 15 '09 at 21:26

About the editor, I don't mind if I just have to use Notepad. If need be, I could write my own. :-) I'm more interested in a compiler or interpreter. – Wim ten Brink Sep 15 '09 at 21:30

Depends on what flavor of BASIC you wish. Besides BASin above which has the added cuteness of emulating a ZX Spectrum (and you can replace it with the ZX81 ROM), if your interest is more centered around the programming language itself, then check for GWBASIC material or for the structured QBASIC – Alexandre Bell Sep 15 '09 at 21:37

To be honest, it doesn't matter which BASIC dialect it is. What is important is that it's modernized enough to be able to run on modern hardware. It's actually going to be used for some real bad programming, where I want to use spaghetti code to write a reasonable complex project and then check if others can decipher the code and perhaps even find bugs. Basically, a test of wits, since you need to be real good to be able to write bad code on purpose. :-) And even better to be able to understand it when reading the code again. (Obfuscated coding!) – Wim ten Brink Sep 16 '09 at 8:47

Answer by Christian Hayter (Sep 19, 2009)

All versions of Microsoft BASIC for DOS, Windows and .NET support line numbers. For example, this is still legal in VB.NET 2008:

Module Module1
    Sub Main()
        Console.WriteLine("Hello world")
        GoTo 10
    End Sub
End Module

Answer by Artelius (Sep 19, 2009)

Have a look at QB64, its main goal is QBasic compatibility (and QBasic supported, but did not require, line numbers. You can use them if you want). Of course it runs on modern systems and provides features you wouldn't dream of under DOS. I'm a seasoned QBasic hacker, and I love doing some awful spaghetti code once in a while ;)

Answer by aramis (Jun 30, 2012)

Chipmunk Basic supports line numbers, and is available for Mac OSX (PPC and Intel), Windows (2K/XP), and Linux.
HotPaw Basic is pretty much the same language, for iPad and iPhone.
Both of these support fully numbered programs.

QB64 is an implementation of the QBASIC language for modern machines, in 64 bit clean code. It supports fully numbered and target point only numbering, as well as text labels. It's available for OSX Intel, Windows XP, and Linux.

Answer by an unregistered user (Jun 06, 2011)

If you go to you can run an old basic interpreter still using 10, 20, 30 etc right from the web browser. It has at least 100 examples already loaded and lots more.

Answer by an unregistered user (Feb 11, 2011)

Try running GWBasic inside DOSBox.

You can download DosBox it at It is an excellent DOS Emulator, very easy to use and runs perfectly on x64 systems.

You can download GWBasic executable off the Internet by looking at Google for the words "GWBasic Download". It should find you a lot of sites where you can get it. Just an example

Enjoy it.

Answer by John R. Strohm (Dec 11, 2009)

As of a few years back, GWBASIC, the original MS-DOS BASIC interpreter was still around, and still usable from a DOS command window. I occasionally still use it when I want to grind a few numbers for e.g. some ham radio project.

The last thing I remember doing with it was calculating capacitance budgets for simple one-transistor Colpitts VFOs. I MIGHT have thrown together something to calculate turns counts for toroid inductors using various cores, I don't remember offhand.

Answer by xtremohack (May 15, 2013)

Yes there is one, Microsoft GW-BASIC interpreter. Download from my mediafire:, The password for the ZIP archive is 'lotsofmetalmo'. I have also included BASCOM basic compiler, It compiles the source codes into Executables, read the 'Readme.txt' before proceeding.

Answer by user213660 (Dec 11, 2009)

Try BBC Basic for Windows ( This version of Basic includes a good colour text editor, and links to many Windows routines. It doesn't need line numbers, but still supports GOTO nnn, and you can add optional line numbers if you want to be nostalgic!

Answer by PauliL (Dec 09, 2009)

I still have old ZBasic compiler for MS-DOS. It allows optional line numbers to be used. ZBasic is no more available on PC, but on Mac, it is still available as FutureBASIC. However, I am not sure if FutureBASIC allows line numbers to be used.

FreeBASIC, which is upward compatible with QBasic, allows numeric labels to be used (in addition to text labels). A numeric label looks just like a line number. I think you could use such a label on every line, effectively making the program to have line numbers.

See the documentation of labels, ProPgLabels at FBWiki.

Answer by Ian Ross (Dec 11, 2009)

You might find this amusing... BASIC + Haskell = headache!

Shared with attribution, where reasonably possible, per the SO attribution policy and cc-by-something. If you were the author of something I posted here, and want that portion removed, just let me know.


Grant Winney

Is there anything more satisfying than sharing knowledge? Of teaching someone and witnessing their "ah ha" moment? I usually write about tech, but no promises. I hope you find something interesting!