Generate bison.1 using help2man.

* doc/common.x, doc/bison.x: New.
* doc/Makefile.am (bison.1, .x.1): New.
The code is taken from autoconf-2.61/man/Makefile.am.
* configure.ac: Look for help2man.
This commit is contained in:
Akim Demaille
2007-11-04 21:13:21 +00:00
parent 6aeb9c579b
commit 727a14014b
6 changed files with 235 additions and 285 deletions

View File

@@ -1,3 +1,11 @@
2007-11-04 Akim Demaille <demaille@gostai.com>
Generate bison.1 using help2man.
* doc/common.x, doc/bison.x: New.
* doc/Makefile.am (bison.1, .x.1): New.
The code is taken from autoconf-2.61/man/Makefile.am.
* configure.ac: Look for help2man.
2007-11-04 Akim Demaille <demaille@gostai.com> 2007-11-04 Akim Demaille <demaille@gostai.com>
Complete --help. Complete --help.

View File

@@ -1,6 +1,6 @@
# Configure template for GNU Bison. -*-Autoconf-*- # Configure template for GNU Bison. -*-Autoconf-*-
# #
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc. # Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@@ -39,7 +39,7 @@ AC_ARG_ENABLE(gcc-warnings,
yes|no) ;; yes|no) ;;
*) AC_MSG_ERROR([bad value ${enableval} for gcc-warnings option]) ;; *) AC_MSG_ERROR([bad value ${enableval} for gcc-warnings option]) ;;
esac], esac],
[enableval=no]) [enableval=no])
if test "${enableval}" = yes; then if test "${enableval}" = yes; then
gl_WARNING_CFLAGS([-Werror]) gl_WARNING_CFLAGS([-Werror])
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS]) AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
@@ -87,6 +87,7 @@ if test x"$ac_cv_prog_gnu_m4" != xyes; then
AC_MSG_ERROR([GNU M4 1.4 is required]) AC_MSG_ERROR([GNU M4 1.4 is required])
fi fi
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.]) AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
AM_MISSING_PROG([HELP2MAN], [help2man])
# Checks for header files. # Checks for header files.
AC_CHECK_HEADERS_ONCE([locale.h]) AC_CHECK_HEADERS_ONCE([locale.h])
@@ -138,11 +139,11 @@ gt_JAVACOMP([1.3])
gt_JAVAEXEC gt_JAVAEXEC
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
build-aux/Makefile build-aux/Makefile
po/Makefile.in po/Makefile.in
data/Makefile data/Makefile
etc/Makefile etc/Makefile
examples/Makefile examples/Makefile
examples/calc++/Makefile examples/calc++/Makefile
lib/Makefile src/Makefile doc/Makefile]) lib/Makefile src/Makefile doc/Makefile])
AC_OUTPUT AC_OUTPUT

View File

@@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*- ## Process this file with automake to produce Makefile.in -*-Makefile-*-
## Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc. ## Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -16,22 +16,72 @@
AM_MAKEINFOFLAGS = --no-split AM_MAKEINFOFLAGS = --no-split
info_TEXINFOS = bison.texinfo info_TEXINFOS = bison.texinfo
man_MANS = bison.1
bison_TEXINFOS = gpl-3.0.texi fdl.texi bison_TEXINFOS = gpl-3.0.texi fdl.texi
EXTRA_DIST = bison.1 refcard.tex CLEANFILES = bison.fns
CLEANFILES = refcard.dvi refcard.log refcard.ps bison.fns
CLEANDIRS = *.t2d CLEANDIRS = *.t2d
clean-local: clean-local:
rm -rf $(CLEANDIRS) rm -rf $(CLEANDIRS)
## ---------- ##
## Ref card. ##
## ---------- ##
EXTRA_DIST = refcard.tex
CLEANFILES += refcard.dvi refcard.log refcard.ps
refcard.dvi: refcard.tex refcard.dvi: refcard.tex
tex refcard.tex tex refcard.tex
refcard.ps: refcard.dvi refcard.ps: refcard.dvi
## ----------- ##
## Man Pages. ##
## ----------- ##
dist_man_MANS = $(srcdir)/bison.1
EXTRA_DIST += $(dist_man_MANS:.1=.x) common.x
MAINTAINERCLEANFILES = $(dist_man_MANS)
# Depend on configure.ac to get version number changes.
common_dep = $(top_srcdir)/configure.ac $(srcdir)/common.x
srcsrcdir = $(top_srcdir)/bin
$(srcdir)/bison.1: $(common_dep) $(top_srcdir)/src/getargs.c
remove_time_stamp = 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
MOSTLYCLEANFILES = $(srcdir)/*.t
SUFFIXES = .x .1
PREPATH = $(top_builddir)/src
.x.1:
@program=`expr "/$*" : '.*/\(.*\)'` && \
save_IFS=$IFS; \
IFS=$(PATH_SEPARATOR); \
for dir in $(PREPATH); do \
IFS=$save_IFS; \
echo cd $$dir '&&' $(MAKE) $(AM_MAKEFLAGS) $$program && \
(cd $$dir && $(MAKE) $(AM_MAKEFLAGS) $$program) || exit; \
done
@echo "Updating man page $@"
PATH="$(PREPATH)$(PATH_SEPARATOR)$$PATH"; \
export PATH; \
$(HELP2MAN) \
--include=$*.x \
--include=$(srcdir)/common.x \
--output=$@.t `echo '$*' | sed 's,.*/,,'`
if sed $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
sed $(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
touch $@; \
else \
mv $@.t $@; \
fi
rm -f $@*.t
## -------------- ## ## -------------- ##
## Doxygenation. ## ## Doxygenation. ##

View File

@@ -1,65 +1,10 @@
.TH BISON 1 local .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
.TH BISON "1" "November 2007" "bison 2.3a+" "User Commands"
.SH NAME .SH NAME
bison \- GNU Project parser generator (yacc replacement) bison \- GNU Project parser generator (yacc replacement)
.SH SYNOPSIS .SH SYNOPSIS
.B bison .B bison
[ [\fIOPTION\fR]... \fIFILE\fR
.BI \-b " file-prefix"
] [
.BI \-\-file-prefix= file-prefix
] [
.B \-d
] [
.BI \-\-defines= defines-file
] [
.B \-g
] [
.BI \-\-graph= graph-file
] [
.B \-k
] [
.B \-\-token-table
] [
.B \-l
] [
.B \-\-no-lines
] [
.BI \-o " outfile"
] [
.BI \-\-output-file= outfile
] [
.BI \-p " prefix"
] [
.BI \-\-name-prefix= prefix
] [
.B \-t
] [
.B \-\-debug
] [
.B \-v
] [
.B \-\-verbose
] [
.B \-V
] [
.B \-\-version
] [
.B \-y
] [
.B \-\-yacc
] [
.B \-h
] [
.B \-\-help
] [
.B \-\-fixed-output-files
]
file
.br
.B yacc
[
.I "similar options and operands"
]
.SH DESCRIPTION .SH DESCRIPTION
.I Bison .I Bison
is a parser generator in the style of is a parser generator in the style of
@@ -112,245 +57,132 @@ are unique. When a long option takes an argument, like
.BR \-\-file-prefix , .BR \-\-file-prefix ,
connect the option name and the argument with connect the option name and the argument with
.BR = . .BR = .
.SS OPTIONS .PP
Generate LALR(1) and GLR parsers.
.PP
Mandatory arguments to long options are mandatory for short options too.
.SS "Operation modes:"
.TP .TP
.BI \-b " file-prefix" \fB\-h\fR, \fB\-\-help\fR
.br display this help and exit
.ns
.TP .TP
.BI \-\-file-prefix= file-prefix \fB\-V\fR, \fB\-\-version\fR
Specify a prefix to use for all output version information and exit
.I bison
output file names. The names are
chosen as if the input file were named
\fIfile-prefix\fP\fB.c\fP.
.TP .TP
.B \-d \fB\-\-print\-localedir\fR
.br output directory containing locale\-dependent data
.ns
Write an extra output file containing macro definitions for the token
type names defined in the grammar and the semantic value type
.BR YYSTYPE ,
as well as a few
.B extern
variable declarations.
.sp
If the parser output file is named
.IB name .c
then this file
is named
\fIname\fP\fB.h\fP.
.sp
This output file is essential if you wish to put the definition of
.B yylex
in a separate source file, because
.B yylex
needs to be able to refer to token type codes and the variable
.BR yylval .
.TP .TP
.BI \-\-defines= defines-file \fB\-\-print\-datadir\fR
The behavior of output directory containing skeletons and XSLT
.B \-\-defines
is the same than
.B \-d
option.
The only difference is that it has an optional argument which is
the name of the output filename.
.TP .TP
.BI \-g \fB\-y\fR, \fB\-\-yacc\fR
.br emulate POSIX Yacc
.ns
Output a graph of the grammar automaton computed by
Bison. If the grammar file is
.BR foo.y
, the output file will be
.BR foo.dot .
.TP .TP
.BI \-\-graph= graph-file \fB\-W\fR, \fB\-\-warnings\fR=\fI[CATEGORY]\fR
The behavior of report the warnings falling in CATEGORY
.BI \-\-graph .SS "Parser:"
is the same than
.BI \-g
option. The only difference is that it has an optional argument which
is the name of the output graph filename.
.TP .TP
.B \-k \fB\-S\fR, \fB\-\-skeleton\fR=\fIFILE\fR
.br specify the skeleton to use
.ns
.TP .TP
.B \-\-token-table \fB\-t\fR, \fB\-\-debug\fR
This switch causes the instrument the parser for debugging
.IB name .tab.c
output to include a list of
token names in order by their token numbers; this is defined in the array
.IR yytname .
Also generated
are #defines for
.IR YYNTOKENS ,
.IR YYNNTS ,
.IR YYNRULES ,
and
.IR YYNSTATES .
.TP .TP
.B \-l \fB\-\-locations\fR
.br enable locations computation
.ns
.TP .TP
.B \-\-no-lines \fB\-p\fR, \fB\-\-name\-prefix\fR=\fIPREFIX\fR
Don't put any prepend PREFIX to the external symbols
.B #line
preprocessor commands in the parser file.
Ordinarily
.I bison
puts them in the parser file so that the C compiler
and debuggers will associate errors with your source file, the
grammar file. This option causes them to associate errors with the
parser file, treating it an independent source file in its own right.
.TP .TP
.BI \-o " outfile" \fB\-l\fR, \fB\-\-no\-lines\fR
.br don't generate `#line' directives
.ns
.TP .TP
.BI \-\-output-file= outfile \fB\-k\fR, \fB\-\-token\-table\fR
Specify the name include a table of token names
.I outfile .SS "Output:"
for the parser file.
.sp
The other output files' names are constructed from
.I outfile
as described under the
.B \-v
and
.B \-d
switches.
.TP .TP
.BI \-p " prefix" \fB\-d\fR, \fB\-\-defines\fR[=\fIFILE\fR]
.br also produce a header file
.ns
.TP .TP
.BI \-\-name-prefix= prefix \fB\-r\fR, \fB\-\-report\fR=\fITHINGS\fR
Rename the external symbols used in the parser so that they start with also produce details on the automaton
.I prefix
instead of
.BR yy .
The precise list of symbols renamed is
.BR yyparse ,
.BR yylex ,
.BR yyerror ,
.BR yylval ,
.BR yychar ,
and
.BR yydebug .
.sp
For example, if you use
.BR "\-p c" ,
the names become
.BR cparse ,
.BR clex ,
and so on.
.TP .TP
.B \-t \fB\-v\fR, \fB\-\-verbose\fR
.br same as `\-\-report=state'
.ns
.TP .TP
.B \-\-debug \fB\-b\fR, \fB\-\-file\-prefix\fR=\fIPREFIX\fR
In the parser file, define the macro specify a PREFIX for output files
.B YYDEBUG
to 1 if it is not already defined,
so that the debugging facilities are compiled.
.TP .TP
.B \-v \fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR
.br leave output to FILE
.ns
.TP .TP
.B \-\-verbose \fB\-g\fR, \fB\-\-graph\fR[=\fIFILE\fR]
Write an extra output file containing verbose descriptions of the also output a graph of the automaton
parser states and what is done for each type of lookahead token in
that state.
.sp
This file also describes all the conflicts, both those resolved by
operator precedence and the unresolved ones.
.sp
The file's name is made by removing
.B .tab.c
or
.B .c
from the parser output file name, and adding
.B .output
instead.
.sp
Therefore, if the input file is
.BR foo.y ,
then the parser file is called
.B foo.tab.c
by default. As a consequence, the verbose
output file is called
.BR foo.output .
.TP .TP
.B \-V \fB\-x\fR, \fB\-\-xml\fR[=\fIFILE\fR]
.br also output an XML report of the automaton
.ns .SS "Warning categories include:"
.TP .TP
.B \-\-version `midrule\-values'
Print the version number of unset or unused midrule values
.I bison
and exit.
.TP .TP
.B \-h `yacc'
.br incompatibilities with POSIX YACC
.ns
.TP .TP
.B \-\-help `all'
Print a summary of the options to all the warnings
.I bison
and exit.
.TP .TP
.B \-y `no\-CATEGORY'
.br turn off warnings in CATEGORY
.ns
.TP .TP
.B \-\-yacc `none'
.br turn off all the warnings
.ns
.TP .TP
.B \-\-fixed-output-files `error'
Equivalent to treat warnings as errors
.BR "\-o y.tab.c" ; .SS "THINGS is a list of comma separated words that can include:"
the parser output file is called .TP
.BR y.tab.c , `state'
and the other outputs are called describe the states
.B y.output .TP
and `itemset'
.BR y.tab.h . complete the core item sets with their closure
The purpose of this switch is to imitate .TP
.IR yacc 's `lookahead'
output file name conventions. explicitly associate lookahead tokens to items
Thus, the following shell script can substitute for .TP
.I yacc `solved'
and is often installed as describe shift/reduce conflicts solving
.IR yacc : .TP
.sp `all'
.RS include all the above information
.ft B .TP
bison \-y "$@" `none'
.ft R disable the report
.sp .SH AUTHOR
.RE Written by Robert Corbett and Richard Stallman.
.SH SEE ALSO .SH "REPORTING BUGS"
.IR yacc (1) Report bugs to <bug\-bison@gnu.org>.
.br .PP
The Id: ChangeLog,v 1.1748 2007/11/04 20:45:32 akim Exp
.IR "Bison Reference Manual" ,
included as the file
.B bison.texinfo
in the
.I bison
source distribution.
.SH DIAGNOSTICS
Self explanatory.
.SH COPYRIGHT .SH COPYRIGHT
Copyright \(co 2006 Free Software Foundation, Inc. Copyright \(co 2007 Free Software Foundation, Inc.
.br .br
This is free software. You may redistribute copies of it under the terms of This is free software; see the source for copying conditions. There is NO
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
There is NO WARRANTY, to the extent permitted by law. .SH "SEE ALSO"
.BR lex (1),
.BR flex (1),
.BR yacc (1).
.PP
The full documentation for
.B bison
is maintained as a Texinfo manual. If the
.B info
and
.B bison
programs are properly installed at your site, the command
.IP
.B info bison
.PP
should give you access to the complete manual.

55
doc/bison.x Normal file
View File

@@ -0,0 +1,55 @@
[name]
bison \- GNU Project parser generator (yacc replacement)
[description]
.I Bison
is a parser generator in the style of
.IR yacc (1).
It should be upwardly compatible with input files designed
for
.IR yacc .
.PP
Input files should follow the
.I yacc
convention of ending in
.BR .y .
Unlike
.IR yacc ,
the generated files do not have fixed names, but instead use the prefix
of the input file.
Moreover, if you need to put
.I C++
code in the input file, you can end his name by a C++-like extension
(.ypp or .y++), then bison will follow your extension to name the
output file (.cpp or .c++).
For instance, a grammar description file named
.B parse.yxx
would produce the generated parser in a file named
.BR parse.tab.cxx ,
instead of
.IR yacc 's
.B y.tab.c
or old
.I Bison
version's
.BR parse.tab.c .
.PP
This description of the options that can be given to
.I bison
is adapted from the node
.B Invocation
in the
.B bison.texinfo
manual, which should be taken as authoritative.
.PP
.I Bison
supports both traditional single-letter options and mnemonic long
option names. Long option names are indicated with
.B \-\-
instead of
.BR \- .
Abbreviations for option names are allowed as long as they
are unique. When a long option takes an argument, like
.BR \-\-file-prefix ,
connect the option name and the argument with
.BR = .

4
doc/common.x Normal file
View File

@@ -0,0 +1,4 @@
[see also]
.BR lex (1),
.BR flex (1),
.BR yacc (1).