Awesome Express BASIC update!
Posted: Wed Jun 12, 2024 12:03 pm
I'm only going to mention just a bit of what has changed. These past weeks, many improvements and fixes were made.
New features include the commands COLOR and LOCATE. String operations have also been implemented.
String variables may be defined with a dollar sign. Comparison and concatenation operations are supported with plus, equals, and not equals. Further concatenation is also supported with commas and semicolons what have the lowest precedence aside from functions.
Strings in statements are stored in memory and swapped for an internal function. This fixed several problems including preserving string case while making keywords uppercase. The strings are given headers that are preserved until a given expression has been fully evaluated. The headers allowed for some interesting ways to read multiple parameters in functions. For now, the header is simple and is limited in scope to work with INSTR().
The trick with the headers is only possible due to treating commas and semicolons as operators. Commas concatenate string or values to strings with a tab between while semicolons do the same without a tab or any spacing. This way, statements such as PRINT, LOCATE, and COLOR may simply evaluate the whole parameter string as one expression. Except color checks if there's a comma first so you may have a QBASIC like syntax. This really helps for functions with multiple non string parameters.
The complication was with having multiple parameters that expect a string at the end of the evaluation. That's where the header helps. The header appends to the left the position of the tab from the last comma concatenation followed by a colon. All strings have the colon at least. The colon is the minimal header.
String functions that work with Express BASIC:
CHR$()
ASC()
STR$()
VAL()
LEN()
INSTR()
MID$()
LEFT$()
RIGHT$()
LTRIM$()
RTRIM$()
UCASE$()
LCASE$()
There's no string arrays or multi dim arrays yet. Only the @() array.
Now that we're able to read multiple parameters in functions, I see a path to implement more array capabilities. Later on...
There's so much going on with this update and I needed to rush it out to fix some previous issues. As always, hopefully we won't have new problems from this update. Wishful thinking. Please let me know if you find any issues.
New features include the commands COLOR and LOCATE. String operations have also been implemented.
String variables may be defined with a dollar sign. Comparison and concatenation operations are supported with plus, equals, and not equals. Further concatenation is also supported with commas and semicolons what have the lowest precedence aside from functions.
Strings in statements are stored in memory and swapped for an internal function. This fixed several problems including preserving string case while making keywords uppercase. The strings are given headers that are preserved until a given expression has been fully evaluated. The headers allowed for some interesting ways to read multiple parameters in functions. For now, the header is simple and is limited in scope to work with INSTR().
The trick with the headers is only possible due to treating commas and semicolons as operators. Commas concatenate string or values to strings with a tab between while semicolons do the same without a tab or any spacing. This way, statements such as PRINT, LOCATE, and COLOR may simply evaluate the whole parameter string as one expression. Except color checks if there's a comma first so you may have a QBASIC like syntax. This really helps for functions with multiple non string parameters.
The complication was with having multiple parameters that expect a string at the end of the evaluation. That's where the header helps. The header appends to the left the position of the tab from the last comma concatenation followed by a colon. All strings have the colon at least. The colon is the minimal header.
String functions that work with Express BASIC:
CHR$()
ASC()
STR$()
VAL()
LEN()
INSTR()
MID$()
LEFT$()
RIGHT$()
LTRIM$()
RTRIM$()
UCASE$()
LCASE$()
There's no string arrays or multi dim arrays yet. Only the @() array.
Now that we're able to read multiple parameters in functions, I see a path to implement more array capabilities. Later on...
There's so much going on with this update and I needed to rush it out to fix some previous issues. As always, hopefully we won't have new problems from this update. Wishful thinking. Please let me know if you find any issues.