This post is intended to provide a walk-through to better understand how we can write math expressions in terms of minilang. I would like to share my approach here on tackling the Further Exploration section in 101-109 Medium 1 Exercise on Stack Machine Interpretation.
In minilang, numbers are passed into the stack program in reversed order. The stack program operates such that:
- The latter value is first pushed to the stack
- The former value is assigned to the register
- The register pops the latter value from the stack and performs an operation with its value
- The return value of the register can then be used to repeat the process from 1 for multiple values