[Coco] CoCo BASIC Interpreter

Arthur Flexser flexser at fiu.edu
Fri Feb 19 22:57:53 EST 2021


You have it slightly wrong, Steve, I'm afraid.  Basic is interpreted, not
compiled, so there is no translation of anything to machine code.

As you probably are aware, each Basic keyword has a one-byte token (or
two-bytes, in the case of functions).
So when Basic's interpreter reaches a byte within the Basic program that
corresponds to a token, it looks up in a table what address in ROM
corresponds to that token and execution jumps to there.  The ROM code for
that token then causes the reading of subsequent bytes of the Basic
program, processing them as the arguments that go with the given command
token, and does whatever it needs to in order to complete the command,
after which it returns to the top level of the interpreter to process
further bytes of the Basic program.

So, no translation of anything to machine code, just using the machine code
already present in the Basic ROMs.

Art

On Fri, Feb 19, 2021 at 10:36 PM Steve Ostrom <smostrom7 at comcast.net> wrote:

> OK, here’s a question about the CoCo BASIC interpreter for all of you guys
> and gals who know much more about interpreters than I do.
>
> Since CoCo BASIC is an interpreted language, I assume CoCo’s interpreter
> reads a line of BASIC code, then translates that to some version of machine
> code, then executes that ML code, then returns to the interpreter for the
> next line of BASIC.  Assuming this is mostly correct, where is that
> generated ML code stored temporarily?  What I would like to do is examine
> that ML code after the BASIC line is interpreted.  I’d need to be able to
> view the code plus the contents of most of the registers.
>
> Maybe this is an easy question for Art Flexser to answer because of all
> his work with ADOS.
>
> Any ideas?
>
> Thanks!
>
> --- Steve ---
>
>
> Sent from Mail for Windows 10
>
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list