# Install bnfc with Homebrew, apt, pacman

BNF Converter. Version 2.9.6.3 via Homebrew; verified from local package data.

## Install

```sh
sudo av install brew:bnfc
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install bnfc
```

  Evidence: local Homebrew formula metadata

### Linux

- Debian apt (92%):

```sh
sudo apt install bnfc
```

  Evidence: Debian stable package indexes: bnfc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- pacman (92%):

```sh
sudo pacman -S bnfc
```

  Evidence: Arch Linux sync databases: bnfc from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

## Package facts

- **Package key:** brew:bnfc
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/bnfc>
- **Version:** 2.9.6.3
- **Source summary:** BNF Converter
- **Homepage:** <https://github.com/BNFC/bnfc>
- **Repository:** <https://github.com/BNFC/bnfc>
- **Upstream docs:** <https://bnfc.readthedocs.io/en/latest>
- **License:** BSD-3-Clause
- **Source archive:** <https://github.com/BNFC/bnfc/archive/refs/tags/v2.9.6.3.tar.gz>
- **Generated:** 2026-07-08T18:08:21+00:00

## Executables

- bnfc (cli)
- bnfc (alias)

## Dependencies

- gmp

## Build dependencies

- cabal-install
- ghc
- sphinx-doc

## Uses from macOS

- libffi

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 2.9.6.3
- Local data: ok
- Upstream repository: https://github.com/BNFC/bnfc
- info: No package-manager update timestamp was available.
- info: No cached GitHub release or tag data was available.
## Project history and usage

BNFC, the BNF Converter, is a compiler-construction tool that turns a Labelled BNF grammar into a compiler front end: abstract syntax, lexer, parser, pretty-printer, test bench, and documentation.

### Project history

BNFC started at Chalmers and the University of Gothenburg. A 2004 Haskell workshop demonstration by Markus Forsberg and Aarne Ranta says Forsberg and Ranta began development in 2002 as a tool generating Haskell.

The same source records that Michael Pellauer retargeted BNFC to C, C++, and Java in 2003, moving it from a Haskell-only generator toward a multilingual compiler-front-end generator.

Modern BNFC documentation describes the LBNF formalism independently of any one output language, and the project now advertises generation for Haskell, Agda, C, C++, Java, OCaml, XML representations, and Pygments syntax highlighters.

### Adoption history

BNFC found adoption in programming-languages courses, research prototypes, and small language implementations where the grammar is the most stable artifact and hand-written front ends would be repetitive.

Its package-manager footprint is narrower than mainstream parser generators but meaningful: Homebrew, Debian/Ubuntu, Arch, and Haskell package ecosystems carry it for developers who want an executable generator rather than a library-only parser toolkit.

### How it is used

A user writes an LBNF grammar, runs bnfc, and then compiles the generated lexer/parser and abstract-syntax code with the target language's usual parser tooling, such as Alex and Happy for Haskell or Flex/Bison-style tools for C-family output.

BNFC is especially useful when the same grammar should produce both implementation artifacts and a readable language specification, keeping parser code, AST constructors, pretty printers, and documentation aligned.

### Why package nerds care

BNFC is package-nerd-significant because it packages an academic compiler-construction idea as a practical command-line generator. It is not just yacc with another syntax; its labeled grammar rules become typed abstract syntax across target languages.

For language-tooling nerds, BNFC sits in the interesting space between parser generators, syntax-specification formalisms, and teaching tools. It makes a grammar file the source of truth for several generated artifacts that are otherwise easy to let drift.

Its long survival in package managers matters because many compiler-course and research tools depend on old but useful grammar generators being installable without reconstructing a Chalmers-era toolchain by hand.

### Timeline

- 2002: Forsberg and Ranta start BNFC as a Haskell-generating tool.
- 2003: BNFC is retargeted to C, C++, and Java by Michael Pellauer.
- 2004: BNFC is demonstrated at the ACM SIGPLAN Haskell workshop.
- 2010s: BNFC migrates into modern package managers and public GitHub maintenance.
- 2020s: BNFC documentation lists target-language support including Haskell, Agda, C, C++, Java, and OCaml.

### Related projects

- Alex and Happy: Haskell lexer and parser tools often used with BNFC's Haskell backend.
- Flex and Bison: traditional lexer/parser tools related to BNFC's C/C++ style generated front ends.
- ANTLR, yacc, and Menhir: parser-generator neighbors with different grammar models and target ecosystems.
- LBNF: the Labelled BNF grammar formalism used by BNFC.

### Sources

- <https://bnfc.digitalgrammars.com/>
- <https://bnfc.digitalgrammars.com/tutorial/bnfc-tutorial.html>
- <https://bnfc.readthedocs.io/_/downloads/en/v2.9.6.1/pdf/>
- <https://bnfc.readthedocs.io/en/latest>
- <https://github.com/BNFC/bnfc>
- <https://github.com/BNFC/bnfc/blob/master/README.md>
- <https://www.cse.chalmers.se/alumni/markus/BNFC/BNFC_HW2004.pdf>


## Security Notes

narrow executable package without higher-risk signals.

- **Geiger risk:** green / low
- narrow executable package without higher-risk signals

## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** bnfc
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## Other Package-Manager Records

- Debian apt - bnfc - 2.9.5-1: normalized package name match | Debian stable package indexes: bnfc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Compiler front-end generator based on Labelled BNF | https://bnfc.digitalgrammars.com/
- Ubuntu apt - bnfc - 2.9.5-1: normalized package name match | Ubuntu 24.04 LTS package indexes: bnfc from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Compiler front-end generator based on Labelled BNF | https://bnfc.digitalgrammars.com/
- pacman - bnfc - 2.9.6.3-18: normalized package name match | Arch Linux sync databases: bnfc from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | A compiler front-end generator. | https://bnfc.digitalgrammars.com/


## Related links

- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://www.automicvault.com/pkg/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [cabal-install](https://www.automicvault.com/pkg/brew/cabal-install/) - Build dependency declared by Homebrew.
- [ghc](https://www.automicvault.com/pkg/brew/ghc/) - Build dependency declared by Homebrew.
- [sphinx-doc](https://www.automicvault.com/pkg/brew/sphinx-doc/) - Build dependency declared by Homebrew.
- [aarch64-elf-gcc](https://www.automicvault.com/pkg/brew/aarch64-elf-gcc/) - Shares av.db curated category or tags: cli, compilers, developer-tools.
- [adaptivecpp](https://www.automicvault.com/pkg/brew/adaptivecpp/) - Shares av.db curated category or tags: cli, compilers, developer-tools.
- [arm-linux-gnueabihf-binutils](https://www.automicvault.com/pkg/brew/arm-linux-gnueabihf-binutils/) - Shares av.db curated category or tags: cli, compilers, developer-tools.
- [arm-none-eabi-binutils](https://www.automicvault.com/pkg/brew/arm-none-eabi-binutils/) - Shares av.db curated category or tags: cli, compilers, developer-tools.
- [arm-none-eabi-gcc](https://www.automicvault.com/pkg/brew/arm-none-eabi-gcc/) - Shares av.db curated category or tags: cli, compilers, developer-tools.
- [bunster](https://www.automicvault.com/pkg/brew/bunster/) - Shares av.db curated category or tags: cli, compilers, developer-tools.
- [cloog](https://www.automicvault.com/pkg/brew/cloog/) - Shares av.db curated category or tags: cli, compilers, developer-tools.
- [creduce](https://www.automicvault.com/pkg/brew/creduce/) - Shares av.db curated category or tags: cli, compilers, developer-tools.
- [foma](https://www.automicvault.com/pkg/brew/foma/) - Local package facts share a topical domain. Shared terms: cli, compiler, compilers, developer, developer-tools.

## Combined YAML source

View the package source record on GitHub. [combined/bnfc.yml](https://github.com/automic-vault/db/blob/main/combined/bnfc.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
