Tuesday, June 15, 2010

Translator – PRINT Command (Release)

The original plan was put all the command test inputs into one set, but the set grew quite large when the PRINT tests were added and especially when all the error test inputs were also added. Therefore, new separate sets were created for the PRINT tests and the error tests. The lone PRINT statement at the end of the LET command tests remains (though it no longer causes a “BUG: not yet implemented” error).

One last thing, it was previously mentioned that the standard C libraries being used with GCC include a command history of the inputs entered in the interactive test input mode, accessed by the up and done arrows. I accidentally discovered a few more features using the function keys (found when F7 was entered in the MSYS window instead of the VIDE2 window where it is the build program shortcut key). These features are:
F1 – Copy one character from previous input at current position
F2 – Pops up a window asking for a character, then copies characters from current position from previous input up to that character
F3 – Copies all characters from previous input at current position
F4 – Pops up a window asking for a character to delete to, then deletes up to the character
F5 – Does the same thing as up-arrow
F6 – Puts Control-Z into buffer (not sure what this is for, possibly Control-Z is an end of file marker from the old DOS days)
F7 – Pop up a window showing are previously entered inputs (each numbered), which can then be selected
F8 – Display previous input (same as up-arrow except rotates around, but only when cursor is a beginning of line)
F9 – Pop up window asking for a Command Number
The Page Up and Page Down go to the first and last inputs saved. I also noticed it seems to remember the inputs even between runs, I'm not sure where it stores this between terminating the program and starting it back up.

Anyway, the Translator now has support for the PRINT command and PRINT functions and ibcp_0.1.13-src.zip has been uploaded at Sourceforge IBCP Project along with the binary for the program. A lot of changes were required to get the PRINT command implemented, the implementation of next command (INPUT) should be easier. Now to get the rest of the error handling working correctly...

Translator – PRINT Working, But...

This release seems to be living up to its unlucky number. I'm going to just put it out shortly and move on. The PRINT command and its error tests are working properly, so there's no reason to do an interim developmental release.  However, not all the error messages are correct.  But first, a few changes need to be described.

A while back, an AssignList flag was added to table entries to identify that the code is an assign list code. This flag was used when processing an operator to identify it as an assign list operator. A temporary flag is set if the operator is an assign list operator before the find code function was called (which only handles the last value in the assignment list and the expression). Upon returning, if this temporary flag is set, then the rest of the assignment list operands are processed.

It turns out this table entry flag is not necessary. Since the temporary flag is set before the find code function (which may change the operator code depending on the data types), the temporary flag can simply be set if the operator code is AssignList.

One other change was made related to list assignments. Previously the AssignList operator was not pushed to the hold stack until the equal token was received, the comma tokens were just deleted. This was changed to push an AssignList Operator token to the hold stack when the first comma token is received (the comma token was changed). This occurs when the mode is changed from Assignment to CommaAssignment (on the first comma token, subsequent comma tokens are still deleted). When the equal token is received, the mode is still changed from CommaAssignment to Expression (but the equal token is now just deleted). This change was necessary to aid in identifying which specific error message is needed when an error occurs (which is still not working correctly).