3 ms·
I actually wrote a rudimentary BASIC interpreter in Scheme that does something like the latter. I invented a BASIC "abstract machine" that could interpret BASIC
by bitwize 3y ago
I actually wrote a rudimentary BASIC interpreter in Scheme that does something like the latter. I invented a BASIC "abstract machine" that could interpret BASIC lines as tree structures. Then when the user typed in program source, the interpreter would parse it, turn it into a BASIC line data structure, and insert it in the proper place in the program. A logical extension which I did not implement is to keep the source of each line (so LIST and SAVE work, for instance).
It's a neat, sensical way to implement BASIC if you have the memory to spare. Crunching everything through tokenization and interpreting the tokens directly makes more sense if you're on an 8-bit, 4k machine however.