Yacc

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 65.102.18.220 (talk) at 03:41, 7 September 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Jump to navigation Jump to search

yacc is a computer program that serves as the standard parser generator on Unix systems. The name is an acronym for "Yet Another Compiler Compiler." It generates a parser (the part of a compiler that tries to make sense of the input) based on an analytic grammar written in BNF notation. Yacc generates the code for the parser in the C programming language.

Yacc was developed by Stephen C. Johnson at AT&T for the Unix operating system. Later compatible programs were written, such as Berkeley Yacc, GNU bison, MKS yacc and Abraxas yacc (an updated version of the original AT&T version is also open source as part of Sun's OpenSolaris project). Each offer 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, EFL, ML, Ada, Java, and Limbo.

Since the parser generated by Yacc requires a lexical analyzer, it is often used in combination with a lexical analyzer generator, in most cases either Lex or the free software alternative Flex. The IEEE POSIX P1003.2 standard defines the functionality and requirements to both Lex and Yacc.

Versions of AT&T Yacc have become open source; the source code is available with the standard distributions of Plan 9 and OpenSolaris.

See also

  • LALR parser: The underlying parsing algorithm in Yacc.
  • GNU bison: The GNU version of Yacc.
  • Lex, the token parser commonly used in conjunction with yacc.

Reference

  • Stephen C. Johnson. YACC: Yet another compiler-compiler. Unix Programmer's Manual Vol 2b, 1979.