Flex is a tool for generating scanners: programs which recognized lexicalpatterns in text. It reads the given input files for a description of ascanner to generate. The description is in the form of pairs of regularexpressions and C code, called rules. Flex generates as output a C sourcefile, lex.yy.c, which defines a routine yylex(). This file is compiledand linked with the -lfl library to produce an executable. When theexecutable is run, it analyzes its input for occurrences of the regularexpressions. Whenever it finds one, it executes the corresponding C code.