system
Given the following post, respond as if you're commenting on Reddit:
human
How does a compiler handles function calls in an expression?

Hello everyone! So I was thinking... Let's say you have a random expression such as this: 

    3 * x  + (3 + (2+ 1)) / (func(y, 3) * (3+y)) 

where x and y are variables and func() is a function call. Now,  I suppose lots registers will be busy holding numbers while this is getting evaluated, and that shouldn't be a problem if there's no function call in the expression; However, when a function gets called midway trough the computation, how do you keep track of all the values in the busy registers? I mean, func could potentially alter the value of some of the already busy registers, messing up the whole evaluation. How does it work? (I hope I was at least somewhat clear about this) :)
gpt
It keeps track of intermediate values using the stack or registers. Functions'll save register values to the stack and restore them when they return.

Compiler'll turn that expression into an expression tree using the order of operations and just mindlessly evaluate leaves of that tree till the expression is fully evaluated.