New English word? Translate any word using double click.
By Mike G Henry
A better way of controlling the robot consists of implementing a rudimentary higher level language described next. At this stage of the game you need to review your BASIC programming manuals so that you have a better feel for all the commands that are available to you and how they are to be used. I will demonstrate the rudiments of a very simple parsing scheme and you can extend this to create as sophisticated a program as you like within the context of using the BASIC language. (To do really serious programming you would use “C” or some other language designed to do such work.) What you can accomplish will also depend on the language that you have designed and going through this exercise will give you some insights into how to design a language that is easier to parse. It all ties together in the end !
The data file that the robot executes can come from a disk file read a line at a time or it can come from DATA statements like we had in the examples above. I will use DATA statements as already shown above for the sake of simplicity and because this allows us to do all our work from within the BASIC environment. This includes the editing of the program as DATA statements. These will constitute our program .
We are working towards using the higher language that we designed for the robot as a part of what we learned on language design from previous experience. Putting it as simply as possible… each DATA statement in the program contains a keyword and the arguments associated with that particular keyword. The program first reads the keyword and then branches to an area of the program designed to process that particular keyword. If for example the keyword is STAND the program jumps to the section of code that executes the STAND command. Here the program expects that there will be no arguments and brings the robot to a STAND position from whatever position the robot was in – in an orderly manner so that it does not fall over. Once that is done the program returns to the main thread of the program to read the next DATA statement and to continue on from there .
IF YOU ARE INTERESTED IN GETTING RIPPED OF $250 – $500 – $1000 – $2000 – $3K – $6K – $10K
$20K – $50K – $100K – $500K – $1MILLION – $3MILLION – UP TO 1000 TRILLION OR MORE
PLEASE INVEST WITH ONE OF THE FOLLOWING BROKERS TO SHOW YOU WHAT FINANCE IS :
** BETTER TO KEEP THE MONEY FOR YOUR KIDS OR ANY EMERGENCY THAT MIGHT ARISE **
If the program reads a word in a DATA statement and it does not match any of the words in its vocabulary or the keyword is misspelled, it knows that an error has taken place and the program jumps to an area where the program is terminated. An error message is usually enunciated on the screen as a part of the termination process so that the operator knows what happened and can take corrective action. Depending on how the program is designed, rather sophisticated messages and even automatic recovery routines can be implemented. As the programming gets more complicated, more sophisticated error messages and other diagnostic techniques are needed to allow
faster debugging .
What is presented is a very simple parsing scheme. Parsing can become quite sophisticated and is one of the more intriguing part of a programmer’s art. Designing fast parsing code can be very complicated. When really fast operations are needed we use compilers. A compiler processes the entire program into more rapidly executable code by eliminating all unnecessary and time consuming processes. Surprisingly a compiled program is usually much longer than an un-compiled program for the same reason that “GO TO LONDON” is shorter than all the instructions that tell you how to get to London. (These longer instructions are however ready to be executed immediately upon reception, i.e. you do not have to go to the book store to purchase a map and puzzle the way to London out etc.)
Many publications have been resourced for this article but please click here for the primary publication used.