yacc(1) on Solnix vs Linux and the BSDs
A default Solnix system runs the illumos yacc at /usr/bin/yacc, which has a small option set (-b -d -l -p -P -Q -t -v -V). The published Solnix page describes a different program, a GNU bison wrapper from pkgs.solnix.bison. Against FreeBSD's Berkeley Yacc, the biggest trap is -P: it selects a parser file on illumos but means reentrant parser on FreeBSD.
The manual pages
- Solnix: yacc(1) from
pkgs.solnix.bison - FreeBSD: yacc(1) 15.1-RELEASE
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
yacc
What Solnix runs
The published Solnix page (pkgs.solnix.bison) describes yacc as a simple wrapper around bison(1) that passes -y, --yacc for upward compatibility mode. The command on PATH by default is the illumos /usr/bin/yacc, which has its own options and behaviour. No other illumos variants are shipped. The bundle contains no Linux page, so no Linux comparison is made.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| FreeBSD | which program it is | Solnix's default yacc is the illumos yacc. FreeBSD's is Berkeley Yacc (page dated 2024-01-09). The published Solnix page describes a bison wrapper, which matches neither. Check which yacc is first on PATH before relying on any option. Source: Solnix yacc(1) DESCRIPTION (published, bison wrapper); Solnix default illumos yacc(1) NAME; FreeBSD yacc(1) NAME |
| FreeBSD | -P meaning | On Solnix's default yacc, -P parser names an alternative parser skeleton instead of /usr/share/lib/ccs/yaccpar. On FreeBSD, -P creates a reentrant parser (like %pure-parser) and takes no argument.Source: Solnix illumos yacc(1) -P; FreeBSD yacc(1) -P |
| FreeBSD | -o output file | FreeBSD yacc has -o output_file to name the parser file, and it overrides -b. The illumos yacc has no -o. Its only way to rename outputs is -b file_prefix, which gives file_prefix.tab.c, file_prefix.tab.h and file_prefix.output.Source: FreeBSD yacc(1) -o, -b; Solnix illumos yacc(1) -b, SYNOPSIS |
| FreeBSD | -V output stream | illumos yacc -V prints the version to standard error. FreeBSD yacc -V prints the version number to standard output. Capturing the version with $(yacc -V) works only on FreeBSD.Source: Solnix illumos yacc(1) -V; FreeBSD yacc(1) -V |
| FreeBSD | FreeBSD-only options | FreeBSD yacc accepts -B, -g, -h, -H, -i, -L, -r, -s and -y. The illumos yacc synopsis lists none of them. -h is a usage message and -y is ignored on FreeBSD. -d is the only header option on illumos.Source: FreeBSD yacc(1) SYNOPSIS and options -B -g -h -H -i -L -r -s -y; Solnix illumos yacc(1) SYNOPSIS |
| FreeBSD | -Q version stamping | The illumos yacc has -Q[y|n]. -Qy puts version information in y.tab.c, and -Qn is the default and writes none. FreeBSD yacc documents no -Q option.Source: Solnix illumos yacc(1) -Q; FreeBSD yacc(1) SYNOPSIS |
| FreeBSD | -t debug code | On illumos, -t compiles runtime debugging code by default, and the YYDEBUG preprocessor symbol still controls it. On FreeBSD, -t changes the generated preprocessor directives, and debug output goes to standard output. The illumos page does not name the output stream.Source: Solnix illumos yacc(1) -t; FreeBSD yacc(1) -t |
| FreeBSD | grammar from stdin | FreeBSD yacc reads the grammar from standard input when the filename is a single '-', and honours '--' as end of options. The illumos page describes the operand only as a path name and does not mention either. Source: FreeBSD yacc(1) DESCRIPTION (last paragraph); Solnix illumos yacc(1) OPERANDS |
| FreeBSD | one yacc per directory | The illumos page warns that output file names are fixed, so at most one yacc process can be active in a directory at a time. The FreeBSD page gives no such warning but offers -b and -o to change the output names.Source: Solnix illumos yacc(1) NOTES; FreeBSD yacc(1) -b, -o |
| FreeBSD | locale and EUC handling | The illumos page documents LANG, LC_ALL, LC_CTYPE, LC_MESSAGES and NLSPATH. It also says EUC characters are handled as one-token symbols, and yylex() must return a wchar_t value for them. The FreeBSD page documents neither. Source: Solnix illumos yacc(1) ENVIRONMENT VARIABLES; FreeBSD yacc(1) (no ENVIRONMENT section) |
| FreeBSD | bison wrapper and -y | The published Solnix yacc is a bison wrapper and passes -y, --yacc, with options as in bison(1). FreeBSD yacc accepts -y but ignores it. It is described as present for ostensible POSIX compatibility with bison.Source: Solnix yacc(1) DESCRIPTION (published); FreeBSD yacc(1) -y |
Standards
- POSIX: yacc is a POSIX.1-2024 utility.
- Solnix: illumos yacc ATTRIBUTES: Interface Stability is Committed; Standard is 'See standards(7)'.
- FreeBSD: The FreeBSD page says POSIX (IEEE 1003.1 2004) documents only names and numbers for %token, though original yacc and bison also accept string literals.
-ssuppresses the extra #define to match original yacc behaviour.
Writing portable scripts
- Stick to
-b,-d,-l,-p,-tand-v, which appear in both the illumos and FreeBSD synopses. Do not use-o,-P,-Vor-Qin portable scripts. - Run yacc in a separate directory per grammar, because the illumos output names are fixed (y.tab.c, y.tab.h, y.output). Use
-bto give each grammar its own prefix.
Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.