That does not appear to be the case. Standard ECMA-55: Minimal BASIC, which says it is “fully compatible” with ANSI X3J2, is dated January 1978, only six months after the Apple II appeared, and work on this was started much earlier, before Gates/Allen or Woz started work on their very first tape versions of BASIC or even the appearance of the Altair 8800:
…in September 1974 the first meeting of the ECMA Committee TC 21, BASIC, toook place. In January 1974, a corresponding committee, X3J2, had been founded in the USA… The ANSI one was distributed for public comments in January 1976…
That ANSI distribution for public comments was less than a year after Gates and Allen had started on the first MS-BASIC, and around the time that Woz was making available preliminary versions of his Integer BASIC.
So the idea of NEXT
etc. being an syntactic and semantic part of a lexical block, rather than a stand-alone statement, was at least contemporary with the early BASICs that implemented it as the latter. It could well be much earlier; I’ve not gone back to look at the early '70s minicomputer versions of BASIC, much less the original Dartmouth BASIC.
For convenience, let’s refer to the “block-structured” BASICs such as the ANSI/ECMA ones as “A-BASIC” (mnemonic: “Algol-like”) and the Gates/Allen/Woz/etc. non-block structured BASICs as “M-BASIC” (mnemonic: “Microcomputer” or “Microsoft”).
Not at all, since in a block-structured language the parser does this by nature.There’s no problem at all with an interpreter running against an AST generated by such a parser and, in fact, pretty much every contemporary and modern interpreter of an Algol-ish language (Bourne shell, TCL, Perl, etc.) does this.
The issue here is that the M-BASICs are line-structured, with every individual line being its own unit, bearing no relation to any other line. NEXT
, as I alluded to above, is a stand-alone keyword with specific run-time behaviour that is very different from what I am calling, for lack of a better term, “block-structured” languages. Consider the following program:
10 FOR I=1 TO 3
20 PRINT "I";I
50 IF I=3 THEN FOR J=1 TO 3 : PRINT "J";J
70 NEXT
This is perfectly valid and does what you would expect in M-BASIC, but should produce a syntax error in A-BASIC, because in the latter, NEXT
is not a stand-alone statement that says “look up the current stack for any executing (stand-alone) FOR
,” but instead must be associated with a specific FOR
in the program text (ECMA-55 §13, p.17, PDF p.22).
Yeah, I’m not so sure that’s true. If you have an M-BASIC background, and know of Algol-like languages, sure, it’s not a big deal to understand the difference above. But would someone with only A-BASIC experience really get to grips “quickly” with programs like the one above?
Actually, it appears to me that licensing Microsoft’s BASIC and extending it appropriately was usually considered a better answer to that than writing your own. Looking at the machines I have around, only my Apple II and Panasonic JR series have their own BASIC, and Apple later switched to an MS-BASIC anyway, which provided more capable Apple-specific graphics support. Radio Shack, Commodore, Hitachi, NEC, Sharp and Fujitsu all shipped their late-70s and early-80s microcomputers with an MS-BASIC; the Japanese ones with plenty of their own extensions for everything from hex literals to graphics to sound to kanji support.
If you simply replace cycle
with do
and repeat
with end
you have Ruby code. So, is Ruby essentially BASIC with some OO stuff added to it?