man-pages/man1/ocamlyacc.1.html
2021-03-31 01:06:50 +01:00

168 lines
3.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of OCAMLYACC</TITLE>
</HEAD><BODY>
<H1>OCAMLYACC</H1>
Section: User Commands (1)<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<P>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
ocamlyacc - The OCaml parser generator
<P>
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>ocamlyacc</B>
[
<B>-b</B><I>prefix</I>
] [
<B>-q</B>
] [
<B>-v</B>
] [
<B>-version</B>
] [
<B>-vnum</B>
]
<I>filename.mly</I>
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
The
<B><A HREF="/cgi-bin/man/man2html?1+ocamlyacc">ocamlyacc</A></B>(1)
command produces a parser from a <A HREF="/cgi-bin/man/man2html?1+LALR">LALR</A>(1) context-free grammar
specification with attached semantic actions, in the style of
<B><A HREF="/cgi-bin/man/man2html?1+yacc">yacc</A></B>(1).
Assuming the input file is
<I>grammar</I>.mly,
running
<B>ocamlyacc</B>
produces OCaml code for a parser in the file
<I>grammar</I>.ml,
and its interface in file
<I>grammar</I>.mli.
<P>
The generated module defines one parsing function per entry point in
the grammar. These functions have the same names as the entry points.
Parsing functions take as arguments a lexical analyzer (a function
from lexer buffers to tokens) and a lexer buffer, and return the
semantic attribute of the corresponding entry point. Lexical analyzer
functions are usually generated from a lexer specification by the
<B><A HREF="/cgi-bin/man/man2html?1+ocamllex">ocamllex</A></B>(1)
program. Lexer buffers are an abstract data type
implemented in the standard library module Lexing. Tokens are values from
the concrete type token, defined in the interface file
<I>grammar</I>.mli
produced by
<B><A HREF="/cgi-bin/man/man2html?1+ocamlyacc">ocamlyacc</A></B>(1).
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<P>
The
<B><A HREF="/cgi-bin/man/man2html?1+ocamlyacc">ocamlyacc</A></B>(1)
command recognizes the following options:
<DL COMPACT>
<DT id="1"><B>-b</B><I>prefix</I>
<DD>
Name the output files
<I>prefix</I>.ml,
<I>prefix</I>.mli,
<I>prefix</I>.output,
instead of the default naming convention.
<DT id="2"><B>-q</B>
<DD>
This option has no effect.
<DT id="3"><B>--strict</B>
<DD>
Reject grammars with conflicts.
<DT id="4"><B>-v</B>
<DD>
Generate a description of the parsing tables and a report on conflicts
resulting from ambiguities in the grammar. The description is put in
file
<I>grammar</I>.output.
<DT id="5"><B>-version</B>
<DD>
Print version string and exit.
<DT id="6"><B>-vnum</B>
<DD>
Print short version number and exit.
<DT id="7"><B>-</B>
<DD>
Read the grammar specification from standard input. The default
output file names are stdin.ml and stdin.mli.
<DT id="8"><B>--</B><I>&nbsp;file</I>
<DD>
Process
<I>file</I>
as the grammar specification, even if its name
starts with a dash (-) character. This option must be the last on the
command line.
<P>
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+ocamllex">ocamllex</A></B>(1).
<BR>
<I>The OCaml user's manual</I>,
chapter &quot;Lexer and parser generators&quot;.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="9"><A HREF="#lbAB">NAME</A><DD>
<DT id="10"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="11"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="12"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="13"><A HREF="#lbAF">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:20 GMT, March 31, 2021
</BODY>
</HTML>