4 ms·
In some ways it is like assembly language: GOTO, GOSUB and such are a lot like branchex and jump. BASIC lacks: (i) subroutine scoped variables (ii) structures
by PaulHoule 3y ago
In some ways it is like assembly language: GOTO, GOSUB and such are a lot like branchex and jump.
BASIC lacks: (i) subroutine scoped variables (ii) structures (like in C) and (iii) hashtables (like in Perl)
(i) makes certain algorithms hard to code, for instance it is much harder to code a Quicksort in BASIC than it is to code a bubble sort or Shell sort.
The pinnacle of advanced programming in BASIC may be these games
https://en.wikipedia.org/wiki/List_of_Scott_Adams_Adventure_video_games https://en.wikipedia.org/wiki/List_of_Scott_Adams_Adventure_...
which runs a strange interpreter that Adams wrote in BASIC that used arrays to emulate ‘objects’ like the lamp or the pirate ship: the game is just a set of data tables that can be loaded by cassette tape.
Scott Adams later wrote interpreters in assembly for computers like the TRS-80 and Apple ][ that would play the same data.
I wouldn’t mind writing tokenizers and parsers in BASIC precisely because these can be table driven and compilers often execute recursive algorithms with an explicit stack anyway.
- rbanffy 3y ago> compilers often execute recursive algorithms with an explicit stack anyway. Threading compilers shouldn't be too bad, but anything more complex would need a lot of extra work. I once implemented recursion using an array for a fake stack and the return stack for the "function", but it was a lot to wrap my then young mind around. I can no longer figure out how I did it.