Garry Pettet
Garry Pettet

Reputation: 8288

What type of interpreter were most 8-bit BASIC implementations?

I’m a big fan of early/mid 1980s personal computers like the Amstrad CPC, Commodore 64 and the Sinclair Spectrum. One thing these computers all had was a version of BASIC.

As a language hacker myself I’m curious: were these interpreters implemented as tree-walker interpreters (simply traversing the parse tree) or bytecode interpreters? I can’t find a lot of information on how they were implemented. It’s fascinating to me how they were built given the limitations of the hardware at the time.

Upvotes: 4

Views: 142

Answers (1)

Wör Du Schnaffzig
Wör Du Schnaffzig

Reputation: 1051

They were mostly token based. This means, that the integrated code editor transformed the human readable commands in the source into a bytecode. Upon execution those bytecodes were read and a dispatcher then executed the appropriate command (stored as machine code in the kernal) with the given parameters. The ZX Spectrum even had a keyboard to enter Basic Tokens:

http://www.worldofspectrum.org/ZX81BasicProgramming/

For some others see here:

https://www.primidi.com/atari_basic/description/the_tokenizer

http://fileformats.archiveteam.org/wiki/Commodore_BASIC_tokenized_file

http://cpctech.cpc-live.com/docs/bastech.html

Hope this anwers your question.

Upvotes: 2

Related Questions