[futurebasic] Re: [FB] I got it working

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2006 : Group Archive : Group : All Groups

From: maxclass@...
Date: Thu, 12 Jan 2006 15:26:39 -0800
Brian,

Listen to Stu. He knows what he is talking about in using CASE  
structures.

Right now I suggest working on your "SYNTAX", especially for any  
strings you need to print.

You need to have something that differentiates a string from any  
other value on any line. If you use CASE's and parse the string onto  
a stack your parser also has to recognize when it is parsing a single  
word string or a multi-word string otherwise it will always grab the  
first word only when you POP values off the stack.

I suggest that you stay with using quotes like PRINT "The quick brown  
fox" otherwise you have no way to tell if [The] is a variable or just  
a part of [the brown fox]. The parser would have to look for a quote  
mark then put everything that follows up to the next quote mark on  
the stack as one item.

Everything on any line would be parsed off as strings on the stack.  
When your CASE statements see something like PRINT then it  
automatically knows that the next item on the stack is the string to  
print.

Another advantage to CASE's is YOU determine the order. When you find  
that something occurs more often than something else you just move  
that CASE more towards the top so it finds it faster. Obviously the  
less used statements would be near the bottom.

A not regarding windows. I find that anytime I my be changing  
windows, like from the Editor to a User window and back or any  
situation where you are changing windows it is always a good idea to  
DIM a variable with a name something like "DIM previousWindow%".  
Then, set this to the current window when you enter a FN. Then set up  
for whatever window you plan to use then set it back before you leave  
with something like the following.

WINDOW OUTPUT previousWindow

This makes it dynamic. In other words it works no matter what the  
previous window was so it is not "hard coded" into the code.

Hope this helps,

Max Taylor
The MaxClass Guy


PS I might have a couple of code examples for you to try regarding  
parsing and stack stuff soon.