Lowercase keywords
LISTO 19 lists keywords in lowercase, but how do you get Matrix Brandy to accept lowercase keywords on input (assuming you can)?
>LISTO 19 >LIST 10 print pi >print pi Mistake >
0
Comments
-
This is not supported (and is not supported by ARM BBC BASIC either).
There is a huge risk of breaking existing code by adding this, as variable names can be made easily distinguishable from keywords simply by using lower case, but supporting lower case keywords would break this.
Matrix Brandy saves programs in plain text and tokenises them upon loading, thus a program that previously worked would be at risk of being broken.0 -
This is not supported (and is not supported by ARM BBC BASIC either).
There's a discussion at the 'BASIC Programming' Facebook Group where it is stated that many BASICs do the opposite: that is accept lowercase keywords on input but provide the option to list them in capitals. That makes sense, since capital keywords are always accepted, but not what Matrix Brandy does.Matrix Brandy saves programs in plain text and tokenises them upon loading, thus a program that previously worked would be at risk of being broken.
Enabling the Lowercase Keywords option - which I don't recommend - is a choice made by the user, and if he makes that choice he must accept the consequences. It's not as though any irreversible loss arises, he simply has to disable that option before loading the old program again!
Trying to protect the user from his own mistakes is all very well, but not at the loss of a facility that many people want. My question was prompted by somebody at Facebook commenting that being forced to enter keywords in capitals was his main complaint about Brandy.0 -
It is indeed a thing in ARM BASIC too, the same LISTO value will list keywords in lower case, but they must still be entered in upper case.
By not implementing this in Brandy isn't really protecting users from themselves, it's not breaking compatibility with old programs that might use variables like "count" and "width" which would cease to be valid variable names.0 -
It is indeed a thing in ARM BASIC too, the same LISTO value will list keywords in lower case, but they must still be entered in upper case.By not implementing this in Brandy isn't really protecting users from themselves, it's not breaking compatibility with old programs that might use variables like "count" and "width" which would cease to be valid variable names.
In fact in Brandy it would be less dangerous than in my versions, because with mine you could potentially re-save the program before you noticed the option is enabled, and that could be irreversible. You couldn't make that mistake in Brandy because it saves the program in plain text.
0 -
Actually, up until a commit a few minutes ago, SAVE was affected by LISTO! Just never noticed it before as it's not a feature I use, so with your current build SAVEing a program with LISTO 16 set would render an unloadable program.
Now that is fixed, I could look to seeing if acceptance of lowercase keywords is feasible with a runtime toggle. Upstream allows immediate-only commands to be accepted in lower or uppercase, but regular keywords were uppercase only. I removed that very early on as it appeared to be a strange anomaly and didn't match either 6502 or ARM BBC BASIC in behaviour (and it was hardwired, not toggleable).0 -
Adding lowercase support back (and across the board, not just immediate mode only keywords) was surprisingly straightforward. So it's added, though disabled by default, and can be enabled with the command line option. '-lck', the config file option 'lowercase' or at runtime with SYS "Brandy_AllowLowercase",1 (use 0 to switch it back off).
I've manually rebuilt the nightlies so this addition is already available for Windows, Linux EL7-9 and Fedora 38-40.1 -
-
It's in upstream:
[soruk@AlmaVM8 tmp]$ tbrandyupstream Brandy Basic V Interpreter Version 1.20.1 (Linux) 24-Sep-2014 Starting with 524288 bytes free >10 PRINT PI >RUN 3.14159265 >LISTO 16 >L. 10print pi >SAVE "pitest" >Q. [soruk@AlmaVM8 tmp]$ cat pitest 10print pi [soruk@AlmaVM8 tmp]$ tbrandyupstream Brandy Basic V Interpreter Version 1.20.1 (Linux) 24-Sep-2014 Starting with 524288 bytes free >LOAD"pitest" >L. 10print pi >RUN '=' missing or syntax error in statement has misled interpreter at line 10 >Q. [soruk@AlmaVM8 tmp]$ _
0 -
I did spot an error in my lowercase implementation - LOAD / CHAIN also followed the setting (as they also use the same underlying primitives for reading text to tokens). This has now been fixed so a program MUST have upper-case keywords irrespective of the lowercase keyword setting. A program written outside of Brandy that contains lowercase keywords can be read in using *EXEC.0
-
Hated_moron wrote: »
This is an (emulated) ARM Evaluation System second processor, with the original V1.00 ARM BASIC - and that supports LISTO 16.
0