- Issue prompt (for this statement, the default “? ” prompt)
- Get the input from the user (allowing for editing like backspace, cursor left/right, insert/overwrite, delete, and terminated by enter)
- Parse an integer value from the input for I% and save it (I% can't actually be assigned yet)
- Check if the next character in the input is a comma
- Parse a double value from the input for A(I%) and save it (A(I%) can't be assigned yet since I% hasn't been assigned)
- Check if there are no more characters
- Push reference of I% to evaluation stack
- Assign saved integer value to reference on top of stack – I%
- Push value of I% to evaluation stack (I% has now been assigned)
- Calculate reference for array A by popping index from evaluation stack, push calculated reference, A(I%), to stack
- Assign saved double value to reference on top of stack – A(%)
- End of INPUT command, advance to next line of output
Saturday, February 19, 2011
INPUT Command – Execution Procedure
To determine how the INPUT command will be encoded into internal memory, the internal codes need to be arranged according to how the INPUT command will be executed including handling errors. Using the same “INPUT I%,A(I%)” example statement from before, here is the procedure (for the moment without taking into account error handling):
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.)