Yacc

From Wikipedia, the free encyclopedia

The correct title of this article is yacc. The initial letter is shown capitalized due to technical restrictions.

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.

[edit] See also

  • 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 grammars: that is, a formal way to describe formal languages.

[edit] Reference

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

[edit] External links