LEX is a program generator that helps write programs to match regular expressions in an input stream. It accepts specifications that define regular expressions and corresponding program fragments. LEX generates a program that recognizes the expressions in the input and executes the associated fragments. The LEX source file associates regular expressions with program fragments. When an expression appears in the input, the corresponding fragment is executed. LEX turns the user's specifications into a host language program that recognizes expressions and performs actions.