Yacc
|
|
This article includes a list of references, but its sources remain unclear because it has insufficient inline citations. (November 2012) |
The computer program Yacc is a parser generator developed by Stephen C. Johnson at AT&T Corporation for the Unix operating system in 1970. The name is an acronym for "Yet Another Compiler Compiler". It generates a parser (the part of a compiler that tries to make syntactic sense of the source code) based on an analytic grammar written in a notation similar to BNF.[1]
Yacc used to be available as the default parser generator on most Unix systems. It has since been supplanted as the default by more recent, largely compatible, programs such as Berkeley Yacc, GNU bison, MKS Yacc and Abraxas PCYACC. An updated version of the original AT&T version is included as part of Sun's OpenSolaris project. Each offers slight improvements and additional features over the original Yacc, but the concept has remained the same. Yacc has also been rewritten for other languages, including Ratfor, ML, Ada, Pascal, Java, Python, Ruby, Go[2] and Common Lisp.
The parser generated by Yacc is a LALR parser. In order to run, it requires an external lexical analyzer.[3] Lexical analyzer generators, such as Lex or Flex are widely available. The IEEE POSIX P1003.2 standard defines the functionality and requirements for both Lex and Yacc.
Some versions of AT&T Yacc have become open source. For example, source code (for different implementations) is available with the standard distributions of Plan 9 and OpenSolaris.
See also [edit]
- Berkeley Yacc: The Berkeley implementation of Yacc quickly became more popular than AT&T Yacc itself because of lack of reuse restrictions and performance.
- LALR parser: The underlying parsing algorithm in Yacc.
- Bison: The GNU version of Yacc.
- Lex (and Flex lexical analyser), the token parser commonly used in conjunction with Yacc (and Bison).
- BNF, is a metasyntax used to express context-free grammar: that is, a formal way to describe formal languages.
References [edit]
- ^ "The A-Z of Programming Languages: YACC". Computerworld. Retrieved 30 November 2012.
- ^ "Yacc.go: A version of Yacc for the Go Programming Language". Retrieved 14 April 2013.
- ^ Stephen C. Johnson. "Yacc: Yet Another Compiler-Compiler". AT&T Bell Laboratories Murray Hill, New Jersey 07974. Retrieved 30 November 2012.
External links [edit]
- Computerworld Interview with Stephen C. Johnson on YACC
- ML-Yacc a Yacc version for the Standard ML language.
- CL-Yacc, a LALR(1)parser generator for Common Lisp.
- PLY a Yacc version for Python
- Yacc theory
- ocamlyacc a Yacc version for OCaml.
- Racc a Yacc version for Ruby.
- Paper "Parsing Non-LR(k) Grammars with Yacc" by Gary H. Merrill
- ANSI C Yacc grammar