Flex

Flex is a tool which generates lexical analysers. It is often used in conjunction with compiler-compiler tools such as yacc in order to generate compilers for languages with reasonably regular grammar.