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>
Complete --help.

View File

@@ -1,6 +1,6 @@
# 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.
#
# This program is free software: you can redistribute it and/or modify
@@ -39,7 +39,7 @@ AC_ARG_ENABLE(gcc-warnings,
yes|no) ;;
*) AC_MSG_ERROR([bad value ${enableval} for gcc-warnings option]) ;;
esac],
[enableval=no])
[enableval=no])
if test "${enableval}" = yes; then
gl_WARNING_CFLAGS([-Werror])
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])
fi
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
AM_MISSING_PROG([HELP2MAN], [help2man])
# Checks for header files.
AC_CHECK_HEADERS_ONCE([locale.h])
@@ -138,11 +139,11 @@ gt_JAVACOMP([1.3])
gt_JAVAEXEC
AC_CONFIG_FILES([Makefile
build-aux/Makefile
po/Makefile.in
data/Makefile
etc/Makefile
build-aux/Makefile
po/Makefile.in
data/Makefile
etc/Makefile
examples/Makefile
examples/calc++/Makefile
lib/Makefile src/Makefile doc/Makefile])
lib/Makefile src/Makefile doc/Makefile])
AC_OUTPUT

View File

@@ -1,5 +1,5 @@
## 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
# it under the terms of the GNU General Public License as published by
@@ -16,22 +16,72 @@
AM_MAKEINFOFLAGS = --no-split
info_TEXINFOS = bison.texinfo
man_MANS = bison.1
bison_TEXINFOS = gpl-3.0.texi fdl.texi
EXTRA_DIST = bison.1 refcard.tex
CLEANFILES = refcard.dvi refcard.log refcard.ps bison.fns
CLEANFILES = bison.fns
CLEANDIRS = *.t2d
clean-local:
rm -rf $(CLEANDIRS)
## ---------- ##
## Ref card. ##
## ---------- ##
EXTRA_DIST = refcard.tex
CLEANFILES += refcard.dvi refcard.log refcard.ps
refcard.dvi: refcard.tex
tex refcard.tex
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. ##

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
bison \- GNU Project parser generator (yacc replacement)
.SH SYNOPSIS
.B bison
[
.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"
]
[\fIOPTION\fR]... \fIFILE\fR
.SH DESCRIPTION
.I Bison
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 ,
connect the option name and the argument with
.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
.BI \-b " file-prefix"
.br
.ns
\fB\-h\fR, \fB\-\-help\fR
display this help and exit
.TP
.BI \-\-file-prefix= file-prefix
Specify a prefix to use for all
.I bison
output file names. The names are
chosen as if the input file were named
\fIfile-prefix\fP\fB.c\fP.
\fB\-V\fR, \fB\-\-version\fR
output version information and exit
.TP
.B \-d
.br
.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 .
\fB\-\-print\-localedir\fR
output directory containing locale\-dependent data
.TP
.BI \-\-defines= defines-file
The behavior of
.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.
\fB\-\-print\-datadir\fR
output directory containing skeletons and XSLT
.TP
.BI \-g
.br
.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 .
\fB\-y\fR, \fB\-\-yacc\fR
emulate POSIX Yacc
.TP
.BI \-\-graph= graph-file
The behavior of
.BI \-\-graph
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.
\fB\-W\fR, \fB\-\-warnings\fR=\fI[CATEGORY]\fR
report the warnings falling in CATEGORY
.SS "Parser:"
.TP
.B \-k
.br
.ns
\fB\-S\fR, \fB\-\-skeleton\fR=\fIFILE\fR
specify the skeleton to use
.TP
.B \-\-token-table
This switch causes the
.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 .
\fB\-t\fR, \fB\-\-debug\fR
instrument the parser for debugging
.TP
.B \-l
.br
.ns
\fB\-\-locations\fR
enable locations computation
.TP
.B \-\-no-lines
Don't put any
.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.
\fB\-p\fR, \fB\-\-name\-prefix\fR=\fIPREFIX\fR
prepend PREFIX to the external symbols
.TP
.BI \-o " outfile"
.br
.ns
\fB\-l\fR, \fB\-\-no\-lines\fR
don't generate `#line' directives
.TP
.BI \-\-output-file= outfile
Specify the name
.I outfile
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.
\fB\-k\fR, \fB\-\-token\-table\fR
include a table of token names
.SS "Output:"
.TP
.BI \-p " prefix"
.br
.ns
\fB\-d\fR, \fB\-\-defines\fR[=\fIFILE\fR]
also produce a header file
.TP
.BI \-\-name-prefix= prefix
Rename the external symbols used in the parser so that they start with
.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.
\fB\-r\fR, \fB\-\-report\fR=\fITHINGS\fR
also produce details on the automaton
.TP
.B \-t
.br
.ns
\fB\-v\fR, \fB\-\-verbose\fR
same as `\-\-report=state'
.TP
.B \-\-debug
In the parser file, define the macro
.B YYDEBUG
to 1 if it is not already defined,
so that the debugging facilities are compiled.
\fB\-b\fR, \fB\-\-file\-prefix\fR=\fIPREFIX\fR
specify a PREFIX for output files
.TP
.B \-v
.br
.ns
\fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR
leave output to FILE
.TP
.B \-\-verbose
Write an extra output file containing verbose descriptions of the
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 .
\fB\-g\fR, \fB\-\-graph\fR[=\fIFILE\fR]
also output a graph of the automaton
.TP
.B \-V
.br
.ns
\fB\-x\fR, \fB\-\-xml\fR[=\fIFILE\fR]
also output an XML report of the automaton
.SS "Warning categories include:"
.TP
.B \-\-version
Print the version number of
.I bison
and exit.
`midrule\-values'
unset or unused midrule values
.TP
.B \-h
.br
.ns
`yacc'
incompatibilities with POSIX YACC
.TP
.B \-\-help
Print a summary of the options to
.I bison
and exit.
`all'
all the warnings
.TP
.B \-y
.br
.ns
`no\-CATEGORY'
turn off warnings in CATEGORY
.TP
.B \-\-yacc
.br
.ns
`none'
turn off all the warnings
.TP
.B \-\-fixed-output-files
Equivalent to
.BR "\-o y.tab.c" ;
the parser output file is called
.BR y.tab.c ,
and the other outputs are called
.B y.output
and
.BR y.tab.h .
The purpose of this switch is to imitate
.IR yacc 's
output file name conventions.
Thus, the following shell script can substitute for
.I yacc
and is often installed as
.IR yacc :
.sp
.RS
.ft B
bison \-y "$@"
.ft R
.sp
.RE
.SH SEE ALSO
.IR yacc (1)
.br
The
.IR "Bison Reference Manual" ,
included as the file
.B bison.texinfo
in the
.I bison
source distribution.
.SH DIAGNOSTICS
Self explanatory.
`error'
treat warnings as errors
.SS "THINGS is a list of comma separated words that can include:"
.TP
`state'
describe the states
.TP
`itemset'
complete the core item sets with their closure
.TP
`lookahead'
explicitly associate lookahead tokens to items
.TP
`solved'
describe shift/reduce conflicts solving
.TP
`all'
include all the above information
.TP
`none'
disable the report
.SH AUTHOR
Written by Robert Corbett and Richard Stallman.
.SH "REPORTING BUGS"
Report bugs to <bug\-bison@gnu.org>.
.PP
Id: ChangeLog,v 1.1748 2007/11/04 20:45:32 akim Exp
.SH COPYRIGHT
Copyright \(co 2006 Free Software Foundation, Inc.
Copyright \(co 2007 Free Software Foundation, Inc.
.br
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.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).