I’ve been working on a variation of BASIC I’m calling Thunky BASIC (I’m not sure if it uses thunks, but if not, something else similarly implements pass-by-name)
Part of the point is that you can make new procedures without losing the nice syntax - I’ve made it so you can implement FOR loops as procedures with similar syntax to traditional BASIC: FOR n=1 TO 9 STEP 2, as opposed to C for(n=1;n<=9;n+=2) or Fortran do n=1,9,2
The way it works, is the separators between arguments don’t need to be commas. In the example, they would be “=” “TO” and “STEP”
(I’ve changed other bits though - you’d need to end a FOR loop with END FOR instead of NEXT)
Many older BASICs didn’t let you put both the start and end of the line in the same command.
On the BBC it might be something like: MOVE x1,y1: DRAW x2,y2
Using my procedure syntax you could combine them:
PROC LINE x1,y1 TO x2,y2 : MOVE x1,y1: DRAW x2,y2
or
PROC LINE x1,y1 TO x2,y2
MOVE x1,y1
DRAW x2,y2
END PROC
(I haven’t implemented any graphics in my interpreter yet though)
As well as not requiring all call syntax to have lots of parentheses and commas, I’ve tried to the language a hybrid of block-based and line-based, so you don’t need all the semicolons you would in C or Pascal, but it uses simpler whitespace rules than Python.
For some reason, I don’t find statement separators within the line (colon in BASIC) as objectionable as statement separators/terminators for single-statement lines (semicolon in Pascal/C)
I’ve found it interesting to play around with. You can try it out at Thunky Basic interactive page and there’s more examples and stuff at Caspian Maclean / Thunky Basic · GitLab
This is a proof of concept I guess - I haven’t implemented all the features that I think should be in the language, and the Python and JavaScript choice for implementation was to get it done quickly.
I reckon the main features could be implemented in under 64k on an 8-bit machine, though I don’t plan to do it myself.
Specifying a FOR loop within the language (without STEP) :
PROC FOR VAR index = start TO finish CMD body
LET index = start
LABEL loop_start
IF index > finish:GOTO loop_done
body
index = index + 1
GO TO loop_start
LABEL loop_done
END PROC
and then you can use:
LET n=0
FOR n=1 TO 10
PUT n
PUT " squared is "
PRINT n*n
END FOR
or
n=0
FOR n=1 TO 10:PUT n:PUT " squared is ":PRINT n*n
(I think you currently need to create a variable n as I’ve shown before passing it as a VAR parameter - but ideally you wouldn’t)