|
5.5.2 Functionality of YACCThe C code generated by YACC can be altered before compiling and executing. The generated parser "rules the show" in that it calls the function yylex() when it needs a token. Figure 3 shows a similar picture to that of LEX in Figure 3 of Chapter 3.
The metalanguage input is in a file called translate.y; the output of YACC is in a file called y.tab.c. the input to the executable a.out program is again the source program because the a.out file contains the included scanner from LEX or the user-written scanner, yylex(). YACC produces a LALR(1) parser. The generated parser produces no output when presented with a correct source program unless the user-written actions contain ouput statements. Send questions and comments to: Karen Lemone |