Upon considering the resulting translation of the INPUT statement, I realized there is an efficiency that can be made. The prompt string expression only needs to be evaluated one time. The resulting string can be left on the evaluation stack until the end of the INPUT statement. This way, if the prompt is needed again due to an input error, the string expression result is available and does not need to be evaluated again.
This means that the PrintStr or PrintTmp code can not be called because both will pop the string from the evaluation stack and PrintTmp will delete a temporary string. After the values are assigned, then the prompt string can be popped from the evaluation stack and deleted if it is a temporary.
There is one other aspect of the INPUT statement that needs to be considered. There is a built-in looping required to deal with errors. Not having to re-evaluate the prompt string expression means that the loop back jump does not have know where string expression codes begin. Next, what the INPUT translation will look like...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)