2011-07-27 07:17:02 -07:00
|
|
|
.\"***********************************************************************
|
|
|
|
.\"* *
|
|
|
|
.\"* OCaml *
|
|
|
|
.\"* *
|
|
|
|
.\"* Xavier Leroy, projet Cristal, INRIA Rocquencourt *
|
|
|
|
.\"* *
|
|
|
|
.\"* Copyright 1996 Institut National de Recherche en Informatique et *
|
|
|
|
.\"* en Automatique. All rights reserved. This file is distributed *
|
|
|
|
.\"* under the terms of the Q Public License version 1.0. *
|
|
|
|
.\"* *
|
|
|
|
.\"***********************************************************************
|
|
|
|
.\"
|
|
|
|
.\" $Id$
|
|
|
|
.\"
|
1996-05-10 06:27:26 -07:00
|
|
|
.TH OCAMLLEX 1
|
1995-11-02 08:54:37 -08:00
|
|
|
|
|
|
|
.SH NAME
|
2011-04-26 05:16:50 -07:00
|
|
|
ocamllex \- The OCaml lexer generator
|
1995-11-02 08:54:37 -08:00
|
|
|
|
|
|
|
.SH SYNOPSIS
|
1996-04-30 07:53:58 -07:00
|
|
|
.B ocamllex
|
2003-07-24 01:57:02 -07:00
|
|
|
[
|
|
|
|
.BI \-o \ output-file
|
|
|
|
]
|
|
|
|
[
|
|
|
|
.B \-ml
|
|
|
|
]
|
1995-11-02 08:54:37 -08:00
|
|
|
.I filename.mll
|
|
|
|
|
|
|
|
.SH DESCRIPTION
|
|
|
|
|
|
|
|
The
|
1996-04-30 07:53:58 -07:00
|
|
|
.BR ocamllex (1)
|
2011-04-26 05:16:50 -07:00
|
|
|
command generates OCaml lexers from a set of regular
|
1995-11-02 08:54:37 -08:00
|
|
|
expressions with associated semantic actions, in the style of
|
|
|
|
.BR lex (1).
|
|
|
|
|
|
|
|
Running
|
1996-04-30 07:53:58 -07:00
|
|
|
.BR ocamllex (1)
|
1995-11-02 08:54:37 -08:00
|
|
|
on the input file
|
|
|
|
.IR lexer \&.mll
|
2011-06-15 05:24:26 -07:00
|
|
|
produces OCaml code for a lexical analyzer in file
|
1995-11-02 08:54:37 -08:00
|
|
|
.IR 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. The functions Lexing.from_channel,
|
|
|
|
Lexing.from_string and Lexing.from_function create
|
|
|
|
lexer buffers that read from an input channel, a character string, or
|
|
|
|
any reading function, respectively.
|
|
|
|
|
2008-09-15 07:05:30 -07:00
|
|
|
When used in conjunction with a parser generated by
|
1996-04-30 07:53:58 -07:00
|
|
|
.BR ocamlyacc (1),
|
1995-11-02 08:54:37 -08:00
|
|
|
the semantic actions compute a value belonging to the type token defined
|
|
|
|
by the generated parsing module.
|
|
|
|
|
2003-07-24 01:57:02 -07:00
|
|
|
.SH OPTIONS
|
|
|
|
|
2008-09-15 07:05:30 -07:00
|
|
|
The
|
2003-07-24 01:57:02 -07:00
|
|
|
.BR ocamllex (1)
|
|
|
|
command recognizes the following options:
|
|
|
|
.TP
|
|
|
|
.B \-ml
|
2008-09-15 07:05:30 -07:00
|
|
|
Output code that does not use OCaml's built-in automata
|
2011-06-15 05:24:26 -07:00
|
|
|
interpreter. Instead, the automaton is encoded by OCaml functions.
|
2008-09-15 07:05:30 -07:00
|
|
|
This option is mainly useful for debugging
|
2003-07-24 01:57:02 -07:00
|
|
|
.BR ocamllex (1),
|
|
|
|
using it for production lexers is not recommended.
|
2008-09-15 07:05:30 -07:00
|
|
|
.TP
|
|
|
|
.BI \-o \ output\-file
|
|
|
|
Specify the name of the output file produced by
|
|
|
|
.BR ocamllex (1).
|
|
|
|
The default is the input file name, with its extension replaced by .ml.
|
|
|
|
.TP
|
|
|
|
.B \-q
|
|
|
|
Quiet mode.
|
|
|
|
.BR ocamllex (1)
|
|
|
|
normally outputs informational messages
|
|
|
|
to standard output. They are suppressed if option
|
|
|
|
.B \-q
|
|
|
|
is used.
|
|
|
|
.TP
|
|
|
|
.BR \-v \ or \ \-version
|
2010-05-20 07:06:29 -07:00
|
|
|
Print version string and exit.
|
|
|
|
.TP
|
|
|
|
.B \-vnum
|
|
|
|
Print short version number and exit.
|
2008-09-15 07:05:30 -07:00
|
|
|
.TP
|
|
|
|
.BR \-help \ or \ \-\-help
|
|
|
|
Display a short usage summary and exit.
|
2003-07-24 01:57:02 -07:00
|
|
|
|
1995-11-02 08:54:37 -08:00
|
|
|
.SH SEE ALSO
|
1996-04-30 07:53:58 -07:00
|
|
|
.BR ocamlyacc (1).
|
1995-11-02 08:54:37 -08:00
|
|
|
.br
|
2011-04-26 05:16:50 -07:00
|
|
|
.IR "The OCaml user's manual" ,
|
1995-11-02 08:54:37 -08:00
|
|
|
chapter "Lexer and parser generators".
|