[Advanced Compiler Lecture Notes] Week 03 (2003/9/29) 1. The main route main toplev_main do_compile compile_file (*lang_hooks.parse_file) = c_common_parse_file yyparse YYLEX = yylex _yylex c_lex cpp_get_token(parse_in) 2. The scanner of gcc: hand-written The parser of gcc: tool-generated (yacc) 3. Two options (of gcc) are mentioned in class. (a) -dy: to set set_yydebug to be "true", and print (to stanard error) parsing information (b) -fdump-translation-unit: to print the tree format (to a particular file) Example: ./gcc -dy -fdump-translation-unit hello.c 2> hello.c.dump Then hello.c.dump will be the output of -dy, and hello.c.tu will be the output of -fdump-translation-unit 4. Twp sed scripts available: -> sed script for parsing log. -> sed script for converting tree structure into html format.