5.2. The Lexical Analyzer Function

The lexical analyzer function, named after rule declarations, recognizes tokens from the input stream and returns them to the parser. Ocamlyacc does not create this function automatically; you must write it so that parser function can call it. The function is sometimes referred to as a lexical scanner.

This function is usually generated by ocamllex. See Chapter 12 Lexer and parser generators (ocamllex, ocamlyacc).