Advanced Compiler HW#02 Homework 2: Follow the program control flow: main() (in main.c) -> toplev_main() (in toplev.c) -> do_compile() (in toplev.c) -> compile_file() (in toplev.c). In function compile_file(), find the statement: (*lang_hooks.parse_file) (set_yydebug);. Specify the succeeding control flow of this statement, i.e., tell where and why the flow jumps. lang_hooks is a variable of type "struct lang_hooks" (defined in langhooks.h), and parse_file, a function pointer, is one of its fields. The value of lang_hooks is assigned to be LANG_HOOKS_INITIALIZER (in c-lang.c), and thus the value of parse_file would be pointed to c_common_parse_file() (defined in c-lex.c). So c_common_parse_file() is the function that is actually called. Note: The argument passing to c_common_parse_file(), set_yydebug, is an integer indicating whether the debugging information of yacc should be generated. Note: PARAMS is one of the ANSI and traditional C compatability macros defined in include/ansidecl.h, #define PARAMS(args) (). See http://www.nondot.org/gcc/ansidecl_8h-source.html Related source files: (*lang_hooks.parse_file) (set_yydebug); //[toplev.c] struct lang_hooks {} //[langhooks.h] void (*parse_file) PARAMS ((int)); //[langhooks.h] const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; //[c-lang.c] #define LANG_HOOKS_INITIALIZER { ..., LANG_HOOKS_PARSE_FILE, ... } //[langhooks-def.h] #define LANG_HOOKS_PARSE_FILE c_common_parse_file //[c-lang.c] void c_common_parse_file (set_yydebug) int set_yydebug ATTRIBUTE_UNUSED; {} //[c-lex.c] int yydebug; //[gengtype-yacc.c]