[Coco] CoCo BASIC Interpreter

William Astle lost at l-w.ca
Sun Feb 21 04:03:28 EST 2021


On 2021-02-20 11:20 a.m., James Jones wrote:
> Every time the interpreter executes a statement, any expressions needing to
> be evaluated are parsed (including all the fiddling with operator
> precedence and parentheses), variables referenced each require a linear
> search of the symbol table (is one in there twice? I'm pretty sure it gets
> looiked up twice), constants converted from text into numeric format,
> statement numbers converted from text into two byte integers and a linear
> search done to find the matching statement.

Variables are only looked up once per reference (and that includes the 
destination of an assignment operation). Obviously, if the same variable 
is referenced multiple times in the same expression, it will be looked 
up once for each reference. The expression evaluation routine also 
doesn't have any backtracking so that can't lead to additional variable 
table lookups either.


More information about the Coco mailing list