Fortunately there were no major problems this time around, but quite some time was required to go through each translator function to make sure token pointers were copied or transferred (moved) appropriately. The token pointer alias temporarily set to a plain pointer was changed to a shared pointer.
By using shared pointers, it is no longer necessary to track the use of tokens, keeping them when they are still used, and deleting them when they are no longer needed. When a shared token pointer goes out of scope or is in a container that gets deleted, it will be automatically deleted if it is no longer used. This also eliminates the need to mark closing parentheses tokens as used or unused and doing special handling to delete parentheses tokens that are in the first and last token of items on the done stack.
Only two minor problems occurred with the changes. The first was in the LET translate routine where the hidden option sub-code (indicating the LET keyword is not present) was set in the assignment token after the token had been moved when appended to the RPN output list. This was resolved by setting the sub-code before appending. The other was that two PRINT statement errors were reversed due to a check for null token pointer being changed incorrectly. Click Continue... for additional details of the changes made.
[branch cpp11 commit fe37432066]
Sunday, September 14, 2014
Subscribe to:
Posts (Atom)