1OCAMLLEX(1)                 General Commands Manual                OCAMLLEX(1)
2
3
4

NAME

6       ocamllex - The Objective Caml lexer generator
7
8

SYNOPSIS

10       ocamllex [ -o output-file ] [ -ml ] filename.mll
11
12

DESCRIPTION

14       The  ocamllex(1)  command generates Objective Caml lexers from a set of
15       regular expressions with associated semantic actions, in the  style  of
16       lex(1).
17
18       Running  ocamllex(1) on the input file lexer.mll produces Caml code for
19       a lexical analyzer in file lexer.ml.
20
21       This file defines one lexing function per entry point in the lexer def‐
22       inition.  These functions have the same names as the entry points. Lex‐
23       ing functions take as argument a lexer buffer, and return the  semantic
24       attribute of the corresponding entry point.
25
26       Lexer  buffers  are  an  abstract data type implemented in the standard
27       library  module  Lexing.  The   functions   Lexing.from_channel,   Lex‐
28       ing.from_string and Lexing.from_function create lexer buffers that read
29       from an input channel, a character string,  or  any  reading  function,
30       respectively.
31
32       When  used  in conjunction with a parser generated by ocamlyacc(1), the
33       semantic actions compute a value belonging to the type token defined by
34       the generated parsing module.
35
36

OPTIONS

38       The ocamllex(1) command recognizes the following options:
39
40
41       -o output-file
42              Specify  the output file name output-file instead of the default
43              naming convention.
44
45
46       -ml    Output code that does not use the Caml built-in automata  inter‐
47              preter.  Instead,  the  automaton  is encoded by Caml functions.
48              This option is useful for debugging ocamllex(1),  using  it  for
49              production lexers is not recommended.
50
51

SEE ALSO

53       ocamlyacc(1).
54       The  Objective  Caml  user's  manual, chapter "Lexer and parser genera‐
55       tors".
56
57
58
59                                                                   OCAMLLEX(1)
Impressum