Re: [stella] Atari 2600 BASIC compiler

Subject: Re: [stella] Atari 2600 BASIC compiler
From: "Fred Quimby" <c9r@xxxxxxxxxxx>
Date: Fri, 8 Jul 2005 20:08:45 -0400
>In thinking about this stuff further-- maybe a full blown parser is 
>overkill.
>I'm not sure if you WANT to support big expressions like
>
>if x < 5 or ( x > 20 and p <> 0) then
>
>If you just wanted to support simple one condition conditionals, I
>think you just need to add in a good tokenizer to toss away excess
>white space.

I think that it would be good to place limits on this so people can more 
easily see the transistion from BASIC to asm.  Maybe allowing at most one 
boolean operator would be a good compromise to give more flexibility in the 
language without abstracting away the assembly too much.

>
>traditionally basic makes users predeclare variables with
>DIM
>One trick (though it doesn't make parsing any simpler!)  is to let
>them declare any variables names they want (so long as they aren't
>reserved words) and then just map them to traditional A-Z, if that's
>helpful (but it would be useful if you could preserve the names they
>give them)
>
>Right now there's a very clean mapping between your variables and the
>bytes of RAM they take up.  I think rather than reserving special
>variables or having a different declaration, just having a few special
>16 bit math functions that take multiple single-byte variables as
>arguments will let you have the fractional stuff without worrying
>about casting or any of that.   from fraction to integer or whatever.

I am thinking of assigning variables once they are used, like a real BASIC 
interpreter does, so you are free to use any names you want, and of course 
issue errors when you use up all the variables.  This should be easy enough 
to do, and would allow seamless declaration of 16-bit variables as well as 
retain reverse-compatibility.

>Of course, I might be thinking ahead to this as a general purpose tool
>that might have pluggable kernals, not just as a clean wrapper to the
>single kernal you've provided

If there are several kernels, I'd like one to be the default because I don't 
want to make things too complicated for people who want to get something 
going.  I think it will be very encouraging to a newbie to be able to get a 
simple game going on the 2600 in a single evening than having to read 
through documentation endlessly.  But additional kernels would also be nice 
for people who want to make games that the current kernel cannot do.


Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com

Current Thread