|
3.6.2 Functionality of LEXThe C code scanner generated by LEX can be altered before it is compiled. The generated scanner is actually written to be "parser-driven"; when it is integrated into a compiler front end, it is invoked by the parser. Figure 3 shows how the tool operates. These steps may vary from system to system:
The LEX metalanguage description is input in a file called lex.1. LEX produces a file called lex.yy.c. The generated lexical analyzer is in UNIX's executable file called a.out. Within the generated lex.yy.c is a C function called yylex() which performs GetChar and other actions discussed in Section 3.2 The resulting scanner matches the longest input sequence. If two regular expressions match a particular input, then the first one defined is used. There are many more details of LEX's functionality to be described, and the reader is invited to look at a user's manual for any available LEX to which you may have access. Send questions and comments to: Karen Lemone |