[Coco] BASIC compiler for Rainbow IDE ? (Roger Taylor)

Andrew keeper63 at cox.net
Thu May 15 11:16:25 EDT 2008


Roger,

I would love to see this available, even though I currently don't use 
the Rainbow IDE (running Linux, for one, and too many other projects in 
the way for another).

I don't know much about how the BASIC interpretor works in the CoCo, but 
if I understand how such things work in general, the system takes each 
line, converts the commands into tokens (and probably stores/looks up 
constants and variables and such into memory locations and/or 
registers), then looks up those tokens in a lookup table which points to 
the individual "commands" coded as assembler routines, executes the 
routine, then returns to the interpretor, where it continues doing the 
same thing until the end.

If I have that correct - might it not be possible to build a compiler 
that just takes out the interpretor steps, and strings together all the 
other pieces as assembler, calling the pieces (in ROM/RAM) the 
interpretor would normally call? You would end up with a smaller 
executable (because you wouldn't compile the code the calls point to, 
they are already machine code from the BASIC ROM), although you might 
not end up with as much extra speed, like a full compiler could possible 
create (ie, IIRC, routines such as the LINE routine aren't very 
optimized in the ROM, for instance).

Going this route, potentially you wouldn't have to code all of the BASIC 
commands, because you would use what is already available in the 
standard ROMs. In fact, you could do this as a "first pass", and later 
revisions change over more of the code to you own code (instead of calls 
to ROM routines, you would call your own custom routines which are 
optimized).

Does any of this make sense? I guess all of this could be "out the 
window" if I am seriously misinterpreting how the BASIC interpretor 
works (hah!). But I don't think I am far off the mark, plus I know I 
have seen various routines in the "Unravelled" ROM code listings to know 
it works something like the above.

Anyhow - as a fan and owner of CBASIC-3, which was a great BASIC 
compiler for the CoCo 3 - and as a fan of BASICs in general - any step 
in this direction would be an interesting one, however you decide to 
pursue it.

I look forward to your progress...

-- Andrew L Ayers, Glendale, Arizona



More information about the Coco mailing list