All material and examples comes from UC Berkeley. Synthesis & inaccuracy is fault of my own, not that of UC Berkeley’s EECS Department. Note that I have not formally taken a CS class, rather do self synthesis. These posts are more so for me to explain it out in a way that I have come to understand and can referrence to later on rather than trying to make it a tutorial.
Computer science programs operate in different series of interrelated environments, which is a mapping from names to values. Global is the encompassing environment frame. Global is often referred to as Parent as well. Subexpressions are evaluated in expressions within its environment. Once evaluated, calls to user-defined functions must evaluate the expressions and statements from the definition of those functions.
If you had code that read:
from operator import mul
x = – 2
Your global would be: mul, square, x
Your expression evaluation would be: square(mul(x,x))
Replace x with -s, so square(mul(-2,-2))
square(-2 * -2)