On Unix-like operating systems, the yacc command is a compiler that generates an LALR (Look-Ahead, Left-to-right, Rightmost-derivation) parser. It is a compiler-compiler: a compiler which creates a compiler. Yacc takes as input a formal description of a programming language, and its output is a parser which executes certain actions, specific to a target architecture, when compiling a program written in the language.

Description

The name “yacc” is an acronym for “Yet Another Compiler-Compiler.” It was extremely popular and was once standard on all Unix systems. It has since been supplanted by more recent compiler-compilers, which are mostly backward compatible with yacc.

  • Description
  • Syntax
  • Related commands
  • Linux commands help

Syntax

yacc [-d] [-l] [-t] [-V] [-v] [ -b file_prefix ] [ -Q [y | n ] ] [ -P parser ] [ -p sym_prefix ] file

cc — Compiler of the C programming language.lex — Generate programs for performing lexical tasks.

yacc -P ~/myparser parser.y