All operators have the same precedence and are right associative, thus 15 – 8 – 3 = 15 – (8 – 3) = 10. As one would expect, brackets will force the expression within them to be evaluated first. Brackets may be nested arbitrarily deeply. An expression never has two operators next to each other (even if separated by a bracket), an assignment operator is always immediately preceded by a variable and the leftmost operator on a line is always an assignment. For readability, spaces may be freely inserted into an expression, except between a negative sign and a number. A negative sign will not appear before a variable. All variables are initialised to zero (0) and retain their values until changed explicitly.
Write a program that will accept and evaluate expressions written in this language. Each expression occupies one line and contains at least one assignment operator, and maybe more.
A = B = 4 C = (D = 2)*_2 C = D = 2 * _2 F = C - D E = D * _10 Z = 10 / 3 #
A = 4, B = 4 C = -4, D = 2 D = -4 No Change E = 40 Z = 3