- When a script calls a function, the interpreter adds it to the call stack and then starts carrying out the function.
- Any functions that are called by that function are added to the call stack further up, and run where their calls are reached.
- When the main function is finished, the interpreter takes it off the stack and resumes execution where it left off in the main code listing.
- If the stack takes up more space than it had assigned to it, it results in a "stack overflow" error.
- Call stack on Wikipedia