Example of A Lex File
The following is an example Lex file for the flex version of Lex. It recognizes strings of numbers (integers) in the input, and simply prints them out.
/*** Definition section ***/ %{ /* C code to be copied verbatim */ #includeIf this input is given to flex, it will be converted into a C file, lex.yy.c. This can be compiled into an executable which matches and outputs strings of integers. For example, given the input:
abc123z.!&*2gj6the program will print:
Saw an integer: 123 Saw an integer: 2 Saw an integer: 6Read more about this topic: Lex (software)
Famous quotes containing the word file:
“Probably nothing in the experience of the rank and file of workers causes more bitterness and envy than the realization which comes sooner or later to many of them that they are stuck and can go no further.”
—Mary Barnett Gilson (1877?)