GNU Bison

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"), 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.

GNU Bison
Original author(s)Robert Corbett
Developer(s)The GNU Project
Initial releaseJune 1985 (1985-06)
Stable release
3.8.2  / 25 September 2021
Repository
Written inC and m4
Operating systemUnix-like
TypeParser generator
LicenseGPL
Websitewww.gnu.org/software/bison/ 

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.

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.

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

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.

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.