Berkeley Yacc
Unix program for parser generation
title: "Berkeley Yacc" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["compiling-tools", "parser-generators", "free-software-programmed-in-c", "public-domain-software-with-source-code"] description: "Unix program for parser generation" topic_path: "general/compiling-tools" source: "https://en.wikipedia.org/wiki/Berkeley_Yacc" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0
::summary Unix program for parser generation ::
::data[format=table title="Infobox software"]
| Field | Value |
|---|---|
| name | Berkeley Yacc |
| author | Robert Corbett |
| developer | Thomas Dickey |
| released | |
| discontinued | |
| ver layout | |
| latest release version | |
| latest release date | |
| latest preview date | |
| programming language | ANSI C89 |
| operating system | Unix-like |
| genre | Parser generator |
| license | public domain |
| website | |
| :: |
| name = Berkeley Yacc | logo = | author = Robert Corbett | developer = Thomas Dickey | released = | discontinued = | ver layout = | latest release version = | latest release date = | latest preview version = | latest preview date = | programming language = ANSI C89 | operating system = Unix-like | platform = | genre = Parser generator | license = public domain | website = Berkeley Yacc (byacc) is a Unix parser generator designed to be compatible with Yacc. It was originally written by Robert Corbett and released in 1989. Due to its liberal license and because it was faster than the AT&T Yacc, it quickly became the most popular version of Yacc. It has the advantages of being written in ANSI C89 and being public domain software.
It contains features not available in Yacc, such as reentrancy, which is implemented in a way that is broadly compatible with GNU Bison.{{ cite web |url=http://invisible-island.net/byacc/byacc.html |title=Berkeley Yacc |website=invisible-island.net |access-date=2020-11-10 |url-status=live |archive-url=https://web.archive.org/web/20201019201738/https://invisible-island.net/byacc/byacc.html |archive-date=2020-10-19 |quote=...support for reentrant code, which has evolved in byacc to the point where it can be compared and tuned against bison. cite web |url=http://invisible-island.net/byacc/CHANGES.html#t20100607 |title=Berkeley Yacc Change log, see entry "2010-06-07 Andres.Meji" |date=2010-06-07 |access-date=2020-11-10 |url-status=live |archive-url=https://web.archive.org/web/20201110220301/https://invisible-island.net/byacc/CHANGES.html#t20100607_u0 |archive-date=2020-11-10
History
In 1985, Robert Corbett developed an original LALR parser generator based on a 1982 paper by DeRemer and Pennello. Corbett wrote it as part of his research towards the Ph.D. he received from University of California, Berkeley in June 1985. It was originally named Byson and was incompatible with Yacc but it was subsequently renamed Bison and became the basis of GNU Bison.
Later in 1985, Corbett developed his LALR parser generator, making it Yacc-compatible and naming it Zeus but subsequently renaming it Zoo. Corbett published the source code for Zoo in a Usenet newsgroup but it went mostly unnoticed until later in September 1989 when Corbett posted on the comp.compilers newsgroup about putting the source code on an FTP server. There was discussion about renaming it and by October 1989 it had become known as Berkeley Yacc (byacc).
In 1995, Chris Dodd developed BtYacc, a backtracking derivative of Berkeley Yacc to support parsing context-sensitive languages like C++, based on a 1993 paper by Merrill describing similar modifications to AT&T Yacc. Its backtracking and semantic disambiguation capabilities allow it to generate parsers for ambiguous grammars. A rule parsed but rejected by semantic information can be rolled back, so that the parser can try another rule. However, it has also been criticized for needing side-effect free trial actions and its inflexible handling of shift-reduce conflicts.
In 1997, Vadim Maslov took over maintenance of BtYacc to support a COBOL parser developed by his company. By 1999, the last 3.0 release, had been converted to C++, making it no longer implemented in C.
In 2000, Thomas E. Dickey ported Berkeley Yacc to OpenVMS to facilitate porting tin to VMS. After failing to find another maintainer, Dickey has maintained Berkeley Yacc since February 2002.{{ cite web |url=http://invisible-island.net/byacc/byacc.html |title=BYACC - BERKELEY YACC |website=invisible-island.net |access-date=2020-11-10 |url-status=live |archive-url=https://web.archive.org/web/20020406011256/http://invisible-island.net/byacc/byacc.html |archive-date=2002-04-06
In 2014, Tom Shields integrated BtYacc backtracking into Berkeley Yacc effectively subsuming BtYacc and again supporting C (instead of only C++) in Dickey releases since April 2014.
Languages
Parser generators typically deal with three languages: the language a generator is implemented in, the language a generated parser is implemented in and of course the metalanguage that describes whatever a generated parser should parse. A fourth language could be considered whatever language a generated parser parses but parser generators do not handle such directly, instead just focusing on generating a parser from a given description while letting the generated parser deal with such. Yacc is written in C and generates parsers in C from its own Yacc metalanguage descriptions. This is also how Berkely Yacc works (thus its compatibility), however, a number of derivatives have been created to allow it to generate parsers in languages other than C.
Ray Lischner developed perl-byacc (pbyacc) from byacc 1.6, so that it could also generate parsers in Perl. Later Richard "Rick" Ohnemus ported the patches from byacc 1.6 to byacc 1.8. And later in 1996, Jake Donham developed p5yacc from perl-yacc 1.8.2 so that its generated Perl parsers would use Perl 5 classes.
In 1994, Mike Kleyn developed tyacc from perl-yacc 1.8.2 so that it could also generate parsers in Tcl
In 1997, Bob Jamison developed BYACC/Java (later called BYACC/J or byaccj) from byacc 1.8, so that it could also generate parsers in Java.
In 2000, Bruce Bahnsen merged in the Java parser capabilities of BYACC/J into perl-yacc and added the ability to generate parsers in Python. In 2013, Thomas Dickerson made further improvements on it deeming it PyByacc.
In 2003, Dave Bodenstab merged tyacc and p5yacc to develop a PERL-TCL-YACC rebasing it from 4.8 release of yacc from FreeBSD (a byacc derivative).
References
References
- (1989-09-02). "PD LALR(1) parser generator".
- (October 1992). "lex & yacc". O'Reilly Media.
- John Levine. (August 2009). "flex & bison". O'Reilly Media.
- (October 1982). "Efficient Computation of LALR(1) Look-Ahead Sets". [[Association for Computing Machinery.
- (1998-09-24). "Re: Anyone extended MAXTABLE in yacc parsers?".
- (June 1985). "Static Semantics and Compiler Error Recovery". [[University of California, Berkeley]].
- (1989-09-06). "Name that PD parser generator".
- (1989-10-03). "Berkeley Yacc (new version)".
- (1995-03-07). "BTYACC -- yacc with backtracking and inherited attributes.".
- "README.txt".
- "README.BYACC".
- (1993-08-01). "Parsing Non-LR(k) grammars with yacc". Software: Practice and Experience.
- "btyacc(1)".
- (13 February 2019). "ChrisDodd/btyacc".
- (2006). "A Backtracking LR Algorithm for Parsing Ambiguous Context-Dependent Languages".
- (1997-10-08). "Version 1.1 of BtYacc (Backtracking Yacc) is available".
- "BtYacc: BackTracking Yacc Parser Generator".
- "Release t20140407".
- (2013-01-14). "ACKNOWLEDGEMENTS".
- "tyacc-0.9.README".
- "BYACC/Java Home Page".
- "master/src/skeleton.c".
- (8 March 2013). "Berkeley Yacc".
- (2013-01-14). "elfprince13/PyByacc".
- "BYACC which produces Perl/Tcl parsers".
::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::