Module of module types for OrderedType,ComparableType,Printable,Serializable,Discrete...
[ocaml.git] / man / ocamllex.m
blob3b1340d3312cd203076e7d927da7764ba62aea30
1 .TH OCAMLLEX 1
3 .SH NAME
4 ocamllex \- The Objective Caml lexer generator
6 .SH SYNOPSIS
7 .B ocamllex
9 .BI \-o \ output-file
12 .B \-ml
14 .I filename.mll
16 .SH DESCRIPTION
18 The
19 .BR ocamllex (1)
20 command generates Objective Caml lexers from a set of regular
21 expressions with associated semantic actions, in the style of
22 .BR lex (1).
24 Running
25 .BR ocamllex (1)
26 on the input file
27 .IR lexer \&.mll
28 produces Caml code for a lexical analyzer in file 
29 .IR lexer \&.ml.
31 This file defines one lexing function per entry point in the lexer
32 definition. These functions have the same names as the entry
33 points. Lexing functions take as argument a lexer buffer, and return
34 the semantic attribute of the corresponding entry point.
36 Lexer buffers are an abstract data type implemented in the standard
37 library module Lexing. The functions Lexing.from_channel,
38 Lexing.from_string and Lexing.from_function create
39 lexer buffers that read from an input channel, a character string, or
40 any reading function, respectively.
42 When used in conjunction with a parser generated by 
43 .BR ocamlyacc (1),
44 the semantic actions compute a value belonging to the type token defined
45 by the generated parsing module.
47 .SH OPTIONS
49 The 
50 .BR ocamllex (1)
51 command recognizes the following options:
53 .TP
54 .BI \-o \ output-file
55 Specify the output file name
56 .IR output-file
57 instead of the default naming convention.
59 .TP
60 .B \-ml
61 Output code that does not use the Caml built-in automata
62 interpreter. Instead, the automaton is encoded by Caml functions.
63 This option is useful for debugging
64 .BR ocamllex (1),
65 using it for production lexers is not recommended.
67 .SH SEE ALSO
68 .BR ocamlyacc (1).
69 .br
70 .I The Objective Caml user's manual,
71 chapter "Lexer and parser generators".