The camllex command produces a lexical analyzer from a set of regular expressions with attached semantic actions, in the style of lex . Assuming the input file is lexer .mll , executing camllex lexer .mll produces Caml Light code for a lexical analyzer in file lexer .ml . This file defines one lexing function per entry point in the lexer definition. These functions have the same names as the entry points. Lexing functions take as argument a lexer buffer, and return the semantic attribute of the corresponding entry point.
Lexer buffers are an abstract data type implemented in the standard library module lexing .
When used in conjunction with a parser generated by camlyacc , the semantic actions compute a value belonging to the type token defined by the generated parsing module. The header section is arbitrary Caml Light text enclosed in curly braces. It can be omitted. If it is present, the enclosed text is copied as is at the beginning of the output file. Entry points The names of the entry points must be valid Caml Light identifiers.