views:

378

answers:

7

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.

Sample:

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.)

+5  A: 

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 http://www.worldofspectrum.org/emulators.html 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

Krugar
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
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.
Krugar
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.)
Workshop Alex
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.
Workshop Alex
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 http://www.geocities.com/KindlyRat/GWBASIC.html for GWBASIC material or http://www.qbcafe.net/qbc/english/download.shtml for the structured QBASIC
Krugar
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!)
Workshop Alex
+2  A: 

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 ;)

Artelius
+1  A: 

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()
10:
        Console.WriteLine("Hello world")
        GoTo 10
    End Sub
End Module
Christian Hayter
+1  A: 

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.

PauliL
+1  A: 

Try BBC Basic for Windows (http://www.rtrussell.co.uk/). 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!

+1  A: 

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

Ian Ross
+1  A: 

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.

John R. Strohm