Access the NEW Basecamp Support Portal

Yacc

« Back to Glossary Index

[GROUP 1: History]
– Developed by Stephen C. Johnson at Bell Labs / AT&T in the early 1970s
– Created to insert an exclusive or operator into a B language compiler
– Directed by colleague Al Aho to Donald Knuth’s work on LR parsing
– Influenced by McIlroy’s TMG compiler-compiler and named in reference to TMG
– Originally written in B programming language, later rewritten in C by Alan Snyder

[GROUP 2: Description]
– Yacc takes a grammar with C code snippets as input
– Outputs a shift-reduce parser in C that executes code snippets associated with each rule
– Actions involve constructing parse trees
– Special identifiers like $$, $1, and $3 refer to items on the parser’s stack
– Full syntactic analysis typically requires an external lexical analyzer for tokenization

[GROUP 3: Impact]
– Yacc was popular and widely used, but has been replaced by newer programs like Berkeley Yacc, GNU Bison, etc.
– Implemented the first versions of languages like AWK, C++, eqn, and Pic
– Used to implement the Portable C Compiler and parsers for various languages
– Rewritten for other languages like OCaml, Ratfor, ML, Ada, Pascal, Java, Python, Ruby, Go, Common Lisp, and Erlang
– Berkeley Yacc became more popular than AT&T Yacc due to performance and lack of reuse restrictions

[GROUP 4: See also]
– Compiler-compiler
– hoc (programming language)

[GROUP 5: References]
– The A-Z of Programming Languages: YACC
– Lex & yacc by John Levine
– Flex & bison by John Levine
– Stephen Curtis Johnson: Geek of the Week
– The Development of the C Language

Yacc (Wikipedia)

Yacc (Yet Another Compiler-Compiler) is a computer program for the Unix operating system developed by Stephen C. Johnson. It is a lookahead left-to-right rightmost derivation (LALR) parser generator, generating a LALR parser (the part of a compiler that tries to make syntactic sense of the source code) based on a formal grammar, written in a notation similar to Backus–Naur form (BNF). Yacc is supplied as a standard utility on BSD and AT&T Unix. GNU-based Linux distributions include Bison, a forward-compatible Yacc replacement.

Yacc
Original author(s)Stephen C. Johnson
Repository
Written inC
Operating systemUnix, Unix-like, Plan 9, Inferno
PlatformCross-platform
TypeCommand
LicensePlan 9: MIT License
« Back to Glossary Index

Request an article

Please let us know what you were looking for and our team will not only create the article but we'll also email you to let you know as soon as it's been published.
Most articles take 1-2 business days to research, write, and publish.
Content/Article Request Form

Submit your RFP

We can't wait to read about your project. Use the form below to submit your RFP!
Request for Proposal

Contact and Business Information

Provide details about how we can contact you and your business.


Quote Request Details

Provide some information about why you'd like a quote.