I found a working, strict Minimal BASIC implementation, both compiled for Windows and the source for it on GitHub. The version: bas55 (ECMA-55 Minimal BASIC System) 1.17.
I'll provide the links below, but I have looked at the document again and ran some code on my Windows machine, and have a few concerns. The EMCA-55 standard was appropriate when filenames were limited to 8 characters and a 3-character extension.
Also due to memory constrictions:
- All lines had to have a unique address or line number (even on the mainframe, COBOL required a 6 digit line number) so that the OS back in 1979 could keep track of where it was and what to execute next.
All variables could only be 2 characters max, and had to be a letter and optionally a number (a, a1, b$, b9$). Same applies to array names.
Special variables, like own1 and own2 are internal and not accessible to the programmer (The variables "own1" and "own2" associated with a for-block are assigned values only upon entry to the for-block through its forstatement. own1 and own2 are variables associated with the particular for-block and not accessible to the programmer.)
All variable value assignments must have "LET" at its start (the language back in 1979 had to be tokenized, LET A=B+C, IF A=B THEN ...).
All Function names can only be one letter "DEF FNA(..." DEF is the token for DEFINE, FN is the action FUNCTION, A is the name of the Function)
Today, Putting it in simple terms, the OS, when we achieved above the line processing, opened extended memory, and the addresses were stored in or if a program had no line numbers, stacks, heaps and pointers were assigned in memory and pointed to the instruction set to execute code stored in a read-only part of the code segment.
See Memory Management: the Stack & the Heap (
https://www.cs.ru.nl/E.Poll/hacking/sli ... _stack.pdf)
I also found that these standards have been upgraded. I found the official ECMA website. I strongly suggest the new BASIC be based not on the 1979 standards, when graphical displays did not exist and memory was in short supply, and see what the current standards are.
See
http://www.ecma-international.org
Since the idea of upgrading SmartBASIC is new, I would give Mr. K time to determine the architecture of the new BASIC. I provide this for informational purposes, and a hope the right standards are used. However, I have not found an updated standards for BASIC. I'll keep looking, but I can also check the IEEE since I'm a member and have access to all their publications, and I can check the ISO, which I followed with my corporate clients.
Here is the link to the C source code for the Bas55 implementation of the 1979 standard:
https://github.com/jorgicor/bas55
Here is the current executable of the 1979 standard:
https://jorgicor.niobe.org/bas55/bas55v117.zip
Here is a sample Minimal BASIC program. Mr. K was right when he said SmartBASIC was based on this standard, as this code runs as-is. This program is called "Sieve of Eratosthenes" and it will print out all prime numbers up to 1000. (In 1979, an array with 1,000 items took up a lot of memory). To give you some perspective, the DEC PDP 8/E had 4K total memory, so BASIC was the operating system, and took up the bulk of the memory.
Code: Select all
10 PRINT "FIND PRIMES FROM 2 TO N (N <= 1000). ENTER N: "
20 INPUT N
30 IF N<2 THEN 10
40 IF N>1000 THEN 10
50 DIM A(1000)
60 LET S=SQR(N)
70 FOR I=2 TO S
80 IF A(I)=1 THEN 130
90 LET D=N/I
100 FOR J=I TO D
110 LET A(I*J)=1
120 NEXT J
130 NEXT I
140 FOR I=2 TO N
150 IF A(I)=1 THEN 170
160 PRINT I
170 NEXT I
180 END
One thing to note is the ECMA-55 Standard leaves some features to be defined by the implementor, given that the limits recommended by the standard are respected. In bas55, the program I installed on a windows, it's documentation says they are:
- Accuracy of evaluation of numeric expressions: we use IEEE 754 double-precision binary floating-point format. The accuracy is defined by that standard. Additionally, we use the system library for mathematical functions. Warning: this makes the results dependant on the operating system where bas55 is compiled or executed.
- End-of-line: we accept Windows and Unix end-of-lines.
- Exrad-width for printing numeric representations: 3 digits.
- Initial value of variables: 0 for numeric variables and array slots; the empty string for string variables.
- Input-prompt: question mark followed by a single space.
- Longest string that can be retained: this is limited by the longest program line allowed, which is 72 as required by the standard. Thus 65 characters can be retined.
- Value of machine infinitesimal: the minimum normal value is 2.2250738585072014 * 10^(-308) approximately, although smaller values can be represented by losing precision. The minimum subnormal value is 4.9406564584124654 * 10^(-324) approximately.
- Value of machine infinity: it is defined by the IEEE 754 standard as a special binary value. You can obtain infinity by dividing one by zero, and a negative infinity by dividing minus one by zero. The maximum normal value is 1.7976931348623157 * 10^(308) approximately.
- Margin for output lines: 80 characters.
- Precision of numeric values: six significant decimal digits; three digits for the exrad.
- Print-zone length: 14 characters.
- Pseudo-random number sequence: we use the system library for random number sequences. Warning: this makes the results dependant on the operating system where bas55 is compiled or executed.
- Significance width for printing numeric representations: a maximum of 14 characters are used: six decimal digits plus three digits for the exrad plus 5 characters to accomodate signs, final space, etc.
- Is unary minus accepted after an operator? Yes, we accept this 1 + -3; and this 1 + –3. Warning: this is not required or accepted by the standard.
- Contrary to the standard, in bas55 zero divided by zero gives an undefined value (not-a-number or NAN), and not positive infinity.