-
Notifications
You must be signed in to change notification settings - Fork 8
/
bnf-mode.info
382 lines (275 loc) · 11.9 KB
/
bnf-mode.info
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
This is bnf-mode.info, produced by makeinfo version 7.0.1 from
bnf-mode.texi.
BNF Mode is a GNU Emacs major mode for editing BNF grammars. Presently
it 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.
This manual is for BNF Mode version 0.4.5.
Copyright © 2019-2022 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, with the Front-Cover Texts
being “A GNU Manual,” and with the Back-Cover Texts as in (a)
below. A copy of the license is included in the section entitled
“GNU Free Documentation License.”
(a) The FSF’s Back-Cover Text is: “You have the freedom to copy and
modify this GNU manual.”
INFO-DIR-SECTION Emacs
START-INFO-DIR-ENTRY
* BNF Mode: (bnf-mode). Major mode for editing BNF grammars.
END-INFO-DIR-ENTRY
File: bnf-mode.info, Node: Top, Next: Introduction, Up: (dir)
BNF Mode User Manual
********************
* Menu:
* Introduction:: The mode description and concepts.
* Installation:: The ways of instalation BNF Mode.
* Usage:: BNF Mode usage.
* Customizing:: Customizing BNF Mode.
* Project Links:: Some important project links.
* Bibliography:: External resources used in the project.
* Index:: Complete index.
* Variable Index:: Variable index.
— The Detailed Node Listing —
Installation
* Installing from Elpa or Melpa::
* Installing using El-get::
* Installing from the Git Repository::
Project Links
* Bugs Tracker::
* Change Log::
File: bnf-mode.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top
1 Introduction
**************
BNF Mode is a GNU Emacs major mode for editing BNF grammars. Presently
it 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.
Bellow canonical BNF notation represented with a BNF is presented.
The syntax of the BNF has been carefully copied from Revised ALGOL 60
report. For more see <http://www.masswerk.at/algol60/report.htm>.
<syntax> ::= <rule> | <rule> <syntax>
<rule> ::= <opt-ws> < <rule-name> > <opt-ws>
::= <opt-ws> <expression> <line-end>
<opt-ws> ::= <space> <opt-ws> | <empty>
<expression> ::= <list> | <list> <opt-ws> <or> <opt-ws>
<expression>
<line-end> ::= <opt-ws> <EOL> | <line-end> <line-end>
<list> ::= <term> | <term> <opt-ws> <list>
<term> ::= <literal> | < <rule-name> >
<literal> ::= <character> <text>
<character> ::= <letter> | <digit> | <symbol>
<letter> ::= A | B | C | D | E | F | G | H | I | J | K | L |
M | N | O | P | Q | R | S | T | U | V | W | X |
Y | Z | a | b | c | d | e | f | g | h | i | j |
k | l | m | n | o | p | q | r | s | t | u | v |
w | x | y | z
<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
<symbol> ::= <or> | <space> | ! | # | $ | % | & | ( | ) |
* | + | , | - | . | / | : | ~ | > | = | < | ? |
@ | [ | \ | ] | ^ | _ | ` | ' | " | { | } | ;
<rule-name> ::= <letter> | <rule-name> <rule-char>
<rule-char> ::= <letter> | <digit> | -
<space> ::= <space, tab or new line character>
<or> ::= |
<empty> ::=
File: bnf-mode.info, Node: Installation, Next: Usage, Prev: Introduction, Up: Top
2 Installation
**************
BNF Mode 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.
* Menu:
* Installing from Elpa or Melpa::
* Installing using El-get::
* Installing from the Git Repository::
File: bnf-mode.info, Node: Installing from Elpa or Melpa, Next: Installing using El-get, Up: Installation
2.1 Installing from Elpa or Melpa
=================================
BNF Mode is available from Elpa, Melpa and Melpa-Stable. If you haven’t
used Emacs’ package manager before, then it is high time you familiarize
yourself with it by reading the documentation in the Emacs manual, see
*note (emacs)Packages::. Then add one of the archives to
‘package-archives’:
• To use Elpa:
(require 'package)
(package-initialize)
• For those who want only formal, tagged releases use Melpa Stable:
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
• For those who want rolling releases as they happen use Melpa:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
Melpa tracks BNF Mode’s Git repository and updates relatively soon
after each commit or formal release. For more detail on setting up see
MELPA Getting Started (https://melpa.org/#/getting-started).
Once you have added your preferred archive, you need to update the
local package list using ‘M-x’ ‘package-refresh-contents’ ‘RET’.
Finally, use ‘M-x’ ‘package-list-packages’ ‘RET’ to get to the package
listing and install ‘bnf-mode’ from there.
There are several ways to install ‘bnf-mode’ after package
initialization:
• You can install ‘bnf-mode’ manually by adding following to your
init file:
(unless (package-installed-p 'bnf-mode)
(package-refresh-contents)
(package-install 'bnf-mode))
• To use Cask (https://cask.github.io/) add following to your ‘Cask’
file:
(source melpa)
(depends-on "bnf-mode")
• To install ‘bnf-mode’ using ‘use-package’ add following to your
init file:
(use-package bnf-mode
:ensure t
;; To use MELPA Stable use ":pin mepla-stable",
;; to use ELPA remove ":pin" line
:pin melpa
:mode "\\.bnf\\'")
File: bnf-mode.info, Node: Installing using El-get, Next: Installing from the Git Repository, Prev: Installing from Elpa or Melpa, Up: Installation
2.2 Installing using El-get
===========================
If you use el-get, just create a recipe file ‘bnf.rcp’:
(:name bnf-mode
:website "https://github.com/sergeyklay/bnf-mode"
:description "BNF Mode: A major mode for editing BNF grammars"
:type github
:pkgname "sergeyklay/bnf-mode")
Then add it to a directory present in ‘el-get-recipe-path’. Then,
use ‘M-x’ ‘el-get-install’ ‘RET’ ‘bnf-mode’ ‘RET’ or add to your init
file:
(el-get-bundle bnf-mode)
File: bnf-mode.info, Node: Installing from the Git Repository, Prev: Installing using El-get, Up: Installation
2.3 Installing from the Git Repository
======================================
BNF Mode depends only on the ‘cl-lib’, which is bundled with GNU Emacs.
Thus you don’t have to install any additional library to satisfy BNF
Mode dependencies. Below are simple steps to install BNF Mode using
manual approach:
Clone the BNF Mode repository:
$ git clone https://github.com/sergeyklay/bnf-mode.git \
~/.emacs.d/site-lisp/bnf-mode
Add this to your init file:
(add-to-list 'load-path "~/.emacs.d/site-lisp/bnf-mode")
Add either of the two following lines to your initialization file.
The first only loads BNF Mode when necessary, the 2nd always during
startup of GNU Emacs:
(autoload 'bnf-mode "bnf-mode" nil t)
;; OR
(require 'bnf-mode)
File: bnf-mode.info, Node: Usage, Next: Customizing, Prev: Installation, Up: Top
3 Usage
*******
By default any file that matches the glob ‘*.bnf’ is automatically
opened in ‘bnf-mode’. To toggle the mode in the current buffer use
‘M-x’ ‘bnf-mode’ ‘RET’.
File: bnf-mode.info, Node: Customizing, Next: Project Links, Prev: Usage, Up: Top
4 Customizing
*************
There are not so much customization options yet.
To customize ‘abbrev-mode’ for ‘bnf-mode’, simple add preffered
abbreviations to ‘bnf-mode-abbrev-table’.
If you want, you can go without any customizations at all. The above
settings are the most bang for the buck in terms of customization. So
users that typically don’t like customize a lot are advised to look at
these settings first. To customize BNF Mode options using textual GUI
system, use the following command: ‘M-x’ ‘customize-group’ ‘RET’ ‘bnf’
‘RET’.
File: bnf-mode.info, Node: Project Links, Next: Bibliography, Prev: Customizing, Up: Top
5 Project Links
***************
* Menu:
* Bugs Tracker::
* Change Log::
File: bnf-mode.info, Node: Bugs Tracker, Next: Change Log, Up: Project Links
5.1 Bugs Tracker
================
Bug tracking is currently handled using the GitHub issue tracker
(https://github.com/sergeyklay/bnf-mode/issues).
File: bnf-mode.info, Node: Change Log, Prev: Bugs Tracker, Up: Project Links
5.2 Change Log
==============
History is tracked in the Git repository
(https://github.com/sergeyklay/bnf-mode/blob/master/NEWS) rather than in
this documentation.
File: bnf-mode.info, Node: Bibliography, Next: Index, Prev: Project Links, Up: Top
6 Bibliography
**************
Below are some links to external resources used when developed BNF Mode:
• RFC822: Standard for ARPA Internet Text Messages.
<https://www.ietf.org/rfc/rfc822.txt>
• RFC5234: Augmented BNF for Syntax Specifications ABNF.
<https://www.ietf.org/rfc/rfc5234.txt>
• RFC7405: Case-Sensitive String Support in ABNF.
<https://www.ietf.org/rfc/rfc7405.txt>
• Revised Report on the Algorithmic Language Algol 60.
<https://www.masswerk.at/algol60/report.htm>
• Wikipedia: Backus–Naur form.
<https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form>
• Wikipedia: Extended Backus–Naur form.
<https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form>
• Wikipedia: Augmented Backus–Naur form.
<https://en.wikipedia.org/wiki/Augmented_Backus%E2%80%93Naur_form>
• ISO/IEC 14977: 1996(E).
<https://www.cl.cam.ac.uk/~mgk25/iso-14977.pdf>
• EBNF: A Notation to Describe Syntax.
<https://www.ics.uci.edu/~pattis/ICS-33/lectures/ebnf.pdf>
File: bnf-mode.info, Node: Index, Next: Variable Index, Prev: Bibliography, Up: Top
Index
*****