[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 (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.
Original author(s) | Stephen C. Johnson |
---|---|
Repository | |
Written in | C |
Operating system | Unix, Unix-like, Plan 9, Inferno |
Platform | Cross-platform |
Type | Command |
License | Plan 9: MIT License |