GNU-devel ELPA - bnf-mode


Major mode for editing BNF grammars.
bnf-mode- (.sig), 2024-Mar-31, 90.0 KiB
Serghei Iakovlev <>
Atom feed
Browse ELPA's repository
CGit or Gitweb

To install this package from Emacs, use package-install or list-packages.

Full description

1. BNF Mode for GNU Emacs

license-GPL_3-green.svg badge.svg bnf-mode.svg bnf-mode-badge.svg bnf-mode-badge.svg

A GNU Emacs major mode for editing BNF grammars.

“Precise language is not the problem. Clear language is the problem.”

Richard Feynman

Currently provides basic syntax and font-locking for BNF files. BNF notation is supported exactly form as it was first announced in the ALGOL 60 report. EBNF and ABNF are not supported but their implementation is planned in the near future.

When developing this mode, the following documents were taken into account:

1.1. Features

  • Basic syntax definition
  • Syntax highlighting

1.2. Installation

Known to work with GNU Emacs 25.1 and later. BNF Mode may work with older versions of Emacs, or with other flavors of Emacs (e.g. XEmacs) but this is not guaranteed. Bug reports for problems related to using BNF Mode with older versions of Emacs will most like not be addressed.

The master of all the material is the Git repository at .

NOTE: The master branch will always contain the latest unstable version. If you wish to check older versions or formal, tagged release, please switch to the relevant tag.

The recommended way is to use ELPA, MELPA Stable or MELPA. If either is in your package-archives, do:

M-x package-install RET bnf-mode RET

To learn on how to use any other installation methods refer to relevant documentation.

1.3. Usage

1.3.1. Interactive Commands
Command (For the M-x prompt.) Description
bnf-mode Switches to BNF Mode.

By default any file that matches the glob *.bnf is automatically opened in bnf-mode.

1.4. Customization

To customize various options, use command as follows:

M-x customize-group RET bnf RET

1.5. Support

Feel free to ask question or make suggestions in our issue tracker .

1.6. Changes

To see what has changed in recent versions of BNF Mode see: .

1.8. License

BNF Mode is open source software licensed under the GNU General Public Licence version 3. Copyright © 2019, 2020, 2021, 2022 Free Software Foundation, Inc.

1.8.1. Note On Copyright Years

In copyright notices where the copyright holder is the Free Software Foundation, then where a range of years appears, this is an inclusive range that applies to every year in the range. For example: 2005-2008 represents the years 2005, 2006, 2007, and 2008.

Old versions

bnf-mode- KiB
bnf-mode- KiB
bnf-mode- KiB
bnf-mode- KiB


bnf-mode NEWS -- history of user-visible changes.

Copyright (C) 2019-2022 Free Software Foundation, Inc.
See the end of the file for license conditions.

This file is about changes in BNF Mode.

* BNF Mode 0.5.0
** GNU Emacs < 25.1 is no longer supported.
Due to difficulties in setting up the environment and test automation, the
version of GNU Emacs older than 25.1 is no longer officially supported. BNF Mode
may still work with older versions of GNU Emacs, like 24.3, or with other
flavors of Emacs (e.g. XEmacs) but this is not guaranteed anymore.

* BNF Mode 0.4.5
** Tests were migrated from ert-runner to buttercup.
Previously BNF Mode used `ert' through `ert-runner' for testing
purposes.  However, it seems `ert-runner' is semi-abandoned.  Thus,
tests were migrated to use more aggressively maintained test
framework calles `buttercup'.

** Removed support of ALGOL 60 style comments.
Actually, this syntax was never part of the BNF and was mistakenly
interpreted as an alternative way of commenting BNF grammars
introduced by Peter Naur.

* BNF Mode 0.4.4
** Rework documentation and provide Info-file.
Previous releases of BNF Mode were bundled with incorrect “dir” file
that contained an invalid link to documentation.  This was
resolved.  All documentation now lives in “info bnf-mode”.

* BNF Mode 0.4.3
** Fixed dependency list in the Cask file.
Dependency list was fixed by specifying `cl-lib' version as well as
removing `rx' (`rx' is part of GNU Emacs actually).  This fixed the
issue reported in <>.
The issue is related to installation from the TAR file.

** CI/CD process was moved on GitHub Actions.

* BNF Mode 0.4.2
** First release in ELPA.

** Introduced ALGOL 60 comments style. Disabled by default.

** Use semicolons as a comments.
Only setting `bnf-mode-algol-comments-style' to non-nil will allow use
semicolons as a regular terminal symbols.

* BNF Mode 0.4.1
** Minor fix related to build & deploy BNF Mode on Travis CI.

* BNF Mode 0.4.0
** Added comment-start-skip to improve recognize comments.

** Return back comment-start and comment-end.

** Use more intelligent terminal syntax recognition.
Added support of ";" character as an extra character used in terminals.

** Provided ability to build installation package.
See make help for more.

* BNF Mode 0.3.2
** First release in MELPA.

** Treat ' and " as a regular symbols.

** Removed no longer needed comment-* variables.

** In the BNF there are no grouping brackets except angle ones.

** Removed the bnf-mode-version function.
Users can easily call describe-package or pkg-info-package-version
interactively if they want to get this information.

* BNF Mode 0.3.1
** Fixed BNF rule name definition to follow ALGOL 60 report.

* BNF Mode 0.3.0
** Nonterminals may be preceded by an unlimited number of spaces.

* BNF Mode 0.2.0
** Comments are no longer use syntax table.

** Changed comment syntax from "#" to ";" to follow RFC822#2.8.

* BNF Mode 0.1.0
** Initial stable release.


GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs.  If not, see <>.

Local variables:
coding: utf-8
mode: outline
paragraph-separate: "[ 	]*$"