GNU Bison

GNU Bison
Original author(s)Robert Corbett
Developer(s)The GNU Project
Initial releaseJune 1985; 39 years ago (1985-06)[1]
Stable release
3.8.2[2] Edit this on Wikidata / 25 September 2021
Repository
Written inC and m4
Operating systemUnix-like
TypeParser generator
LicenseGPL
Websitewww.gnu.org/software/bison/ Edit this on Wikidata

GNU Bison, commonly known as Bison, is a parser generator that is part of the GNU Project. Bison reads a specification in Bison syntax (described as "machine-readable BNF"[3]), warns about any parsing ambiguities, and generates a parser that reads sequences of tokens and decides whether the sequence conforms to the syntax specified by the grammar.

The generated parsers are portable: they do not require any specific compilers. Bison by default generates LALR(1) parsers but it can also generate canonical LR, IELR(1) and GLR parsers.[4]

In POSIX mode, Bison is compatible with Yacc, but also has several extensions over this earlier program, including

  • Generation of counterexamples for conflicts
  • Location tracking (e.g., file, line, column)
  • Rich and internationalizable syntax error messages in the generated parsers
  • Customizable syntax error generation,
  • Reentrant parsers
  • Push parsers, with autocompletion
  • Support for named references
  • Several types of reports (graphical, XML) on the generated parser
  • Support for several programming languages (C, C++, D, or Java)

Flex, an automatic lexical analyser, is often used with Bison, to tokenise input data and provide Bison with tokens.[5]

Bison was originally written by Robert Corbett in 1985.[1] Later, in 1989, Robert Corbett released another parser generator named Berkeley Yacc. Bison was made Yacc-compatible by Richard Stallman.[6]

Bison is free software and is available under the GNU General Public License, with an exception (discussed below) allowing its generated code to be used without triggering the copyleft requirements of the licence.

  1. ^ a b Corbett, Robert Paul (June 1985). Static Semantics and Compiler Error Recovery (Ph.D.). University of California, Berkeley. DTIC ADA611756.
  2. ^ Akim Demaille (25 September 2021). "Bison 3.8.2".
  3. ^ "Language and Grammar (Bison 3.8.1)". www.gnu.org. Retrieved 2021-12-26.
  4. ^ Bison Manual: Introduction.
  5. ^ Levine, John (August 2009). flex & bison. O'Reilly Media. ISBN 978-0-596-15597-1.
  6. ^ "AUTHORS". bison.git. GNU Savannah. Retrieved 2017-08-26.