doc: factor ifnottex/iftex examples
[bison.git] / README
blob489caa7042c91701be253e9454130399c4fedf7e
1 GNU Bison is a general-purpose parser generator that converts an annotated
2 context-free grammar into a deterministic LR or generalized LR (GLR) parser
3 employing LALR(1) parser tables.  Bison can also generate IELR(1) or
4 canonical LR(1) parser tables.  Once you are proficient with Bison, you can
5 use it to develop a wide range of language parsers, from those used in
6 simple desk calculators to complex programming languages.
8 Bison is upward compatible with Yacc: all properly-written Yacc grammars
9 work with Bison with no change.  Anyone familiar with Yacc should be able to
10 use Bison with little trouble.  You need to be fluent in C, C++ or Java
11 programming in order to use Bison.
13 Bison and the parsers it generates are portable, they do not require any
14 specific compilers.
16 GNU Bison's home page is https://gnu.org/software/bison/.
18 # Installation
19 ## Build from git
20 The [README-hacking.md file](README-hacking.md) is about building, modifying
21 and checking Bison.  See its "Working from the Repository" section to build
22 Bison from the git repo.  Roughly, run:
24     $ git submodule update --init
25     $ ./bootstrap
27 then proceed with the usual `configure && make` steps.
29 ## Build from tarball
30 See the [INSTALL file](INSTALL] for generic compilation and installation
31 instructions.
33 Bison requires GNU m4 1.4.6 or later.  See
34 https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz.
36 ## Running a non installed bison
37 Once you ran `make`, you might want to toy with this fresh bison before
38 installing it.  In that case, do not use `src/bison`: it would use the
39 *installed* files (skeletons, etc.), not the local ones.  Use `tests/bison`.
41 ## Colored diagnostics
42 As an experimental feature, diagnostics are now colored, controlled by the
43 `--color` and `--style` options.
45 To use them, install the libtextstyle library before configuring Bison.  It
46 is available from https://alpha.gnu.org/gnu/gettext/, for instance
47 https://alpha.gnu.org/pub/gnu/gettext/libtextstyle-0.20.5.tar.gz.
49 The option --color supports the following arguments:
50 - always, yes: Enable colors.
51 - never, no: Disable colors.
52 - auto, tty (default): Enable colors if the output device is a tty.
54 To customize the styles, create a CSS file, say `bison-bw.css`, similar to
56     /* bison-bw.css */
57     .warning   { }
58     .error     { font-weight: 800; text-decoration: underline; }
59     .note      { }
61 then invoke bison with `--style=bison-bw.css`, or set the `BISON_STYLE`
62 environment variable to `bison-bw.css`.
64 ## Relocatability
65 If you pass `--enable-relocatable` to `configure`, Bison is relocatable.
67 A relocatable program can be moved or copied to a different location on the
68 file system.  It can also be used through mount points for network sharing.
69 It is possible to make symlinks to the installed and moved programs, and
70 invoke them through the symlink.
72 See "Enabling Relocatability" in the documentation.
74 ## Internationalization
75 Bison supports two catalogs: one for Bison itself (i.e., for the
76 maintainer-side parser generation), and one for the generated parsers (i.e.,
77 for the user-side parser execution).  The requirements between both differ:
78 bison needs ngettext, the generated parsers do not.  To simplify the build
79 system, neither are installed if ngettext is not supported, even if
80 generated parsers could have been localized.  See
81 http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for more
82 details.
84 # Questions
85 See the section FAQ in the documentation (doc/bison.info) for frequently
86 asked questions.  The documentation is also available in PDF and HTML,
87 provided you have a recent version of Texinfo installed: run `make pdf` or
88 `make html`.
90 If you have questions about using Bison and the documentation does not
91 answer them, please send mail to <help-bison@gnu.org>.
93 # Bug reports
94 Please send bug reports to <bug-bison@gnu.org>.  Be sure to include the
95 version number from `bison --version`, and a complete, self-contained test
96 case in each bug report.
98 # Copyright statements
99 For any copyright year range specified as YYYY-ZZZZ in this package, note
100 that the range specifies every single year in that closed interval.
102 <!--
104 LocalWords:  parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american md
105 LocalWords:  MERCHANTABILITY GLR LALR IELR submodule init README src bw
106 LocalWords:  Relocatability symlinks symlink
108 Local Variables:
109 mode: markdown
110 fill-column: 76
111 ispell-dictionary: "american"
112 End:
114 Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2020 Free
115 Software Foundation, Inc.
117 This file is part of GNU bison, the GNU Compiler Compiler.
119 Permission is granted to copy, distribute and/or modify this document
120 under the terms of the GNU Free Documentation License, Version 1.3 or
121 any later version published by the Free Software Foundation; with no
122 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
123 Texts.  A copy of the license is included in the "GNU Free
124 Documentation License" file as part of this distribution.