take care of ?? in comment cause I didn't know why when I write this code.
Functions intruduction:
-
next(): next just dispose source code, it's called lexical analysis. In this function we never emit any code.
-
expression(): it's a part of semantic analysis, it also emit codes.
-
statement(): it's a higher level semantic analysis than expression(), expression() was only invoked in this function, it also emit codes.
-
match(): it's a encapsulation of next(), we check whether the token is what we want and call next() function.
-
enum_declaration(): Parse the enum declaration and save as ID in symbol tables.
-
function_parameter(): We use this function to parse parameter in function define.it needs to save the paramet in symbol table as local variable.
-
function_body(): We use this to parse function body, there are two steps, first is dispose local variable in function body, and emit code for function call and function return. It also call statement() function to emit the code of what the function really do.
-
function_declaration(): Use for parse function and call above function to emit code.
-
global_declaration(): Parse enmu, variable and function.
-
program(): Using for parsing all source code, it will call global_declaration().