How would you design a system to manage nested operations for a calculator that correctly separates operations by mathematical terms?