Comments
Loading Dream Comments...
You must be logged in to write a comment - Log In
How to parse a combined monadic and dyadic function call expression.
For example { X <:: one squee dyadicoperator two three 137; }
Where one, two, and three are monadic functions (such as .sin. or .abs.) and dyadicoperator is a dyadic function call (such as * or + or .div.). (PEMDAS rules obviously apply to +-* and .div.). 137 is a numeric constant. Your mission, ::SHE+ILA:: is to scan right (i.e. in ascending program counter sequence) pushing future operations onto the parse stack, and executing present operations.
[1] Push "X <::"
[2] push "one"
[3] push "squee" onto the dyadic operand hold stack
[4] push "dyadicoperator"
[5] push "two"
[6] push "three"
[7] execute 137
[8] pop "three" and execute the function, passing parameter 137
[9] pop "two" passing the executed result of "three 137"
[10] pop "dyadicoperator" and execute it, passing the popped "squee" as the LH operand (from the dyadic operand stack) and the executed result of "two three 137" as the RH operand
[11] Penultimately, pop "one" and pass the result so far as its parameter
[12] Now pop "X" and "<::", in order to store the result in store X.
QED :)