When calling SemantMe() on the function body, we should run a counter on the number of variable declarations (including inside if and while blocks). That way, we will know how much space to leave for the prelude of the function. We should also save the total number of variable declarations inside the function.
Inside the statement of the variable declaration (and only inside statements, not in global variables), we should save the index of the variable declaration inside the encompassing function.
The total size of the prelude should be: (1 + counter) * 4, where the 1 stands for the RA.
Includes: AST_DEC_FUNC.java AST_DEC_FUNC_ARG.java AST_DEC_FUNC_ARG_LIST.java AST_STMT_ASSIGN.java AST_STMT_RETURN.java
When calling
SemantMe()
on the function body, we should run a counter on the number of variable declarations (including inside if and while blocks). That way, we will know how much space to leave for the prelude of the function. We should also save the total number of variable declarations inside the function.Inside the statement of the variable declaration (and only inside statements, not in global variables), we should save the index of the variable declaration inside the encompassing function.
The total size of the prelude should be:
(1 + counter) * 4
, where the 1 stands for the RA.