COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Each time a procedure is called, space for its local variable is pushed onto ____
A
buffer
B
registers
C
stack
D
memory
Explanation: 

Detailed explanation-1: -If local variables are required, they are allocated on the stack. By adjusting the rsp register, additional memory is allocated on the stack for locals. As such, when the function is completed, the memory used for the stack-based local variables is released (and no longer uses memory).

Detailed explanation-2: -New activation records are PUSHed onto the stack during procedure calls and the POPed from the stack when the procedure call returns. Note that stack operations affect the top (i.e., most recent) record on the stack.

Detailed explanation-3: -By default, local variables are automatic variables, which means that their memory is allocated automatically on the stack when the function is called and is deallocated when the function terminates.

There is 1 question to complete.