Flex is a fast lexical analyser generator. It is a tool for generating programs that perform pattern-matching on text.