No project description provided
Project description
GKD-BNF
pip install gkdbnf
.
Maybe the most simplest way to write pretty BNF in LaTex.
Use this package with gkdtex
:
Usage
\gkd@bnf{
<i, j> :: Integer
<b> :: Boolean
<l> :: Labels
!Instructions! <h> :: !Instr[MinSIL]! = \mathbf{load} \; i %%% \qquad \qquad describe load
| \mathbf{store} \; i
| \mathbf{push} \; \zeta
| \mathbf{pop}
| \mathbf{jump\mbox{-}if} l %%% consume TOS.
| \cdots
<e> ::= <e> ( <e> * ) | atom
}
Syntax
Valid BNF Syntax:
atom ::= NONTERMINAL
| TERMINAL
| TERMINAL2
| '|'
rule ::= '%%%' TERMINAL2
description ::= TERMINAL | TERMINAL2
type ::= TERMINAL | TERMINAL2 | NONTERMINAL
prod ::= description? NONTERMINAL '::' type '=' atom+ rule?
| '|' atom+ rule?
start ::= start NEWLINE
| start prod
| NEWLINE
| prod
Lexer rule by regex:
NEWLINE = [\r\n]+
NONTERMINAL = <.*?>
TERMINAL2 = !.*?!
TERMINAL = \S+
Whitespace tokens are ignored.
Nice Error Report
1: \gkd@usepackage{gkdbnf}
2: \gkd@bnf{
3: <a> ::= a + 1
4:
5: <c> ::= a a
6: Expressions e ::= e
7: }
You get error
SyntaxError: filename runtest/a.tex:
line 6, column 13, NonTerm not match
Then you know you should change Expression e
to Expression <e>
.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
gkdbnf-0.4.2-py3-none-any.whl
(12.3 kB
view details)
File details
Details for the file gkdbnf-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: gkdbnf-0.4.2-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4ad93229a488239c95a445a775792c1bbdd368273500b2a8837fd542833937b |
|
MD5 | 2dec2cccab057899c8b6abc1d5405d8a |
|
BLAKE2b-256 | 41995826243fcd1971039e5a117e9907f9947f87c1e79f0297f8e35bc0439aca |