University of Washington Computer Science & Engineering
CSE 303: Concepts and Tools for Software Development - Autumn 2004
 About Us    Search    Contact Info 
The gzip'ed, tar'ed file flexExamples.tar.gz contains:

Files   Comments
wc.flex   A simple word count program (like wc). To build it, use 'make wc'.
 
nums.h
nums.flex
nums-main.cxx
  A flex program that extracts strings that look like numbers from stdin. To build it, 'make nums'. To run, try './nums.exe <nums-lexer.c'.

Note: The flex implementation is slightly more complicated than necessary to show off some features of flex that might be useful to you.

Note: main() has been separated into another file in this example, to show how that's done. Part of how that's done is the two lines beginning extern in nums.h.