README 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.
  7. Bison is upward compatible with Yacc: all properly-written Yacc grammars
  8. work with Bison with no change. Anyone familiar with Yacc should be able to
  9. use Bison with little trouble. You need to be fluent in C, C++ or Java
  10. programming in order to use Bison.
  11. Bison and the parsers it generates are portable, they do not require any
  12. specific compilers.
  13. GNU Bison's home page is https://gnu.org/software/bison/.
  14. # Installation
  15. ## Build from git
  16. The [README-hacking.md file](README-hacking.md) is about building, modifying
  17. and checking Bison. See its "Working from the Repository" section to build
  18. Bison from the git repo. Roughly, run:
  19. $ git submodule update --init
  20. $ ./bootstrap
  21. then proceed with the usual `configure && make` steps.
  22. ## Build from tarball
  23. See the [INSTALL file](INSTALL) for generic compilation and installation
  24. instructions.
  25. Bison requires GNU m4 1.4.6 or later. See
  26. https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz.
  27. ## Running a non installed bison
  28. Once you ran `make`, you might want to toy with this fresh bison before
  29. installing it. In that case, do not use `src/bison`: it would use the
  30. *installed* files (skeletons, etc.), not the local ones. Use `tests/bison`.
  31. ## Colored diagnostics
  32. As an experimental feature, diagnostics are now colored, controlled by the
  33. `--color` and `--style` options.
  34. To use them, install the libtextstyle library, 0.20.5 or newer, before
  35. configuring Bison. It is available from https://alpha.gnu.org/gnu/gettext/,
  36. for instance https://alpha.gnu.org/gnu/gettext/libtextstyle-0.20.5.tar.gz,
  37. or as part of Gettext 0.21 or newer, for instance
  38. https://ftp.gnu.org/gnu/gettext/gettext-0.21.tar.gz.
  39. The option --color supports the following arguments:
  40. - always, yes: Enable colors.
  41. - never, no: Disable colors.
  42. - auto, tty (default): Enable colors if the output device is a tty.
  43. To customize the styles, create a CSS file, say `bison-bw.css`, similar to
  44. /* bison-bw.css */
  45. .warning { }
  46. .error { font-weight: 800; text-decoration: underline; }
  47. .note { }
  48. then invoke bison with `--style=bison-bw.css`, or set the `BISON_STYLE`
  49. environment variable to `bison-bw.css`.
  50. In some diagnostics, bison uses libtextstyle to emit special escapes to
  51. generate clickable hyperlinks. The environment variable
  52. `NO_TERM_HYPERLINKS` can be used to suppress them. This may be useful for
  53. terminal emulators which produce garbage output when they receive the escape
  54. sequence for a hyperlink. Currently (as of 2020), this affects some versions
  55. of emacs, guake, konsole, lxterminal, rxvt, yakuake.
  56. ## Relocatability
  57. If you pass `--enable-relocatable` to `configure`, Bison is relocatable.
  58. A relocatable program can be moved or copied to a different location on the
  59. file system. It can also be used through mount points for network sharing.
  60. It is possible to make symlinks to the installed and moved programs, and
  61. invoke them through the symlink.
  62. See "Enabling Relocatability" in the documentation.
  63. ## Internationalization
  64. Bison supports two catalogs: one for Bison itself (i.e., for the
  65. maintainer-side parser generation), and one for the generated parsers (i.e.,
  66. for the user-side parser execution). The requirements between both differ:
  67. bison needs ngettext, the generated parsers do not. To simplify the build
  68. system, neither are installed if ngettext is not supported, even if
  69. generated parsers could have been localized. See
  70. https://lists.gnu.org/r/bug-bison/2009-08/msg00006.html for more
  71. details.
  72. # Questions
  73. See the section FAQ in the documentation (doc/bison.info) for frequently
  74. asked questions. The documentation is also available in PDF and HTML,
  75. provided you have a recent version of Texinfo installed: run `make pdf` or
  76. `make html`.
  77. If you have questions about using Bison and the documentation does not
  78. answer them, please send mail to <help-bison@gnu.org>.
  79. # Bug reports
  80. Please send bug reports to <bug-bison@gnu.org>. Be sure to include the
  81. version number from `bison --version`, and a complete, self-contained test
  82. case in each bug report.
  83. # Copyright statements
  84. For any copyright year range specified as YYYY-ZZZZ in this package, note
  85. that the range specifies every single year in that closed interval.
  86. <!--
  87. LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american md
  88. LocalWords: MERCHANTABILITY GLR LALR IELR submodule init README src bw
  89. LocalWords: Relocatability symlinks symlink
  90. Local Variables:
  91. mode: markdown
  92. fill-column: 76
  93. ispell-dictionary: "american"
  94. End:
  95. Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2021 Free
  96. Software Foundation, Inc.
  97. This file is part of GNU bison, the GNU Compiler Compiler.
  98. Permission is granted to copy, distribute and/or modify this document
  99. under the terms of the GNU Free Documentation License, Version 1.3 or
  100. any later version published by the Free Software Foundation; with no
  101. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  102. Texts. A copy of the license is included in the "GNU Free
  103. Documentation License" file as part of this distribution.
  104. -->