diff options
author | Karl Berry <karl@freefriends.org> | 2020-01-11 22:12:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-01-11 22:12:45 +0000 |
commit | c4a0bbcf412535772b9e62a9640ae004528143d7 (patch) | |
tree | 01c216791d06b8e53ec08876bf75711ec7b20742 /Master/texmf-dist/doc/latex/simplebnf | |
parent | f95ba02a931a571b7b8e60bb6aa8403128931037 (diff) |
simplebnf (11jan20)
git-svn-id: svn://tug.org/texlive/trunk@53370 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/simplebnf')
-rw-r--r-- | Master/texmf-dist/doc/latex/simplebnf/LICENSE | 21 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/simplebnf/README.md | 11 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/simplebnf/simplebnf-doc.pdf | bin | 0 -> 38470 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/simplebnf/simplebnf-doc.tex | 82 |
4 files changed, 114 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/simplebnf/LICENSE b/Master/texmf-dist/doc/latex/simplebnf/LICENSE new file mode 100644 index 00000000000..3a0de6d06fd --- /dev/null +++ b/Master/texmf-dist/doc/latex/simplebnf/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright © 2019-2020 Jay Lee <jaeho.lee@snu.ac.kr> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Master/texmf-dist/doc/latex/simplebnf/README.md b/Master/texmf-dist/doc/latex/simplebnf/README.md new file mode 100644 index 00000000000..240e26de0b7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/simplebnf/README.md @@ -0,0 +1,11 @@ +# simplebnf +simplebnf is a simple package to format Backus-Naur form. The package provides a simple way to format Backus-Naur form (BNF). It parses BNF expressions, possibly with annotations. + +## Documentation +See the [simplebnf-doc.pdf](https://github.com/Zeta611/simplebnf/blob/master/simplebnf-doc.pdf) file. + +## Authors +- Jay Lee <jaeho.lee@snu.ac.kr> + +## License +simplebnf is available under the MIT license. See the [LICENSE](https://github.com/Zeta611/simplebnf/blob/master/LICENSE) file for more info. diff --git a/Master/texmf-dist/doc/latex/simplebnf/simplebnf-doc.pdf b/Master/texmf-dist/doc/latex/simplebnf/simplebnf-doc.pdf Binary files differnew file mode 100644 index 00000000000..02434f6b7fc --- /dev/null +++ b/Master/texmf-dist/doc/latex/simplebnf/simplebnf-doc.pdf diff --git a/Master/texmf-dist/doc/latex/simplebnf/simplebnf-doc.tex b/Master/texmf-dist/doc/latex/simplebnf/simplebnf-doc.tex new file mode 100644 index 00000000000..e30c524e85c --- /dev/null +++ b/Master/texmf-dist/doc/latex/simplebnf/simplebnf-doc.tex @@ -0,0 +1,82 @@ +\documentclass[a4paper]{article} + +\usepackage{fontspec} +\setmainfont{Linux Libertine} +\setsansfont{Libertinus Sans} +\setmonofont{Inconsolata} + +\usepackage{hyperref} + +\usepackage{tcolorbox} +\tcbuselibrary{listings,breakable} +\tcbset{listing engine=listings,colframe=black,colback=white,size=small} +\NewDocumentEnvironment {exampleside} {} + { \tcblisting{listing side text,righthand width=.4\textwidth} } + { \endtcblisting } + +\NewDocumentEnvironment { presentcommand } { b } + {% + \vspace*{0.5\baselineskip}\noindent\fbox{% + \begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule} + #1 + \end{minipage}}\vspace*{0.5\baselineskip} + } + { } + +\NewDocumentCommand \cmd { m } { \texttt{\textbackslash#1} } +\NewDocumentCommand \env { m m } + { + \texttt{% + \textbackslash begin\{#1\} \textrm{#2} % + \textbackslash end\{#1\}% + }% + } + +\usepackage{simplebnf} + +\title{% + \textsf{simplebnf} --- A simple package to format Backus-Naur form% + \footnote{This file describes v0.1.0.}} +\author{Jay Lee\footnote{E-mail: % + \href{mailto:jaeho.lee@snu.ac.kr}{\texttt{jaeho.lee@snu.ac.kr}}}} +\date{2019/12/23} + +\begin{document} +\maketitle + +\begin{presentcommand} + \cmd{bnfexpr} \cmd{bnfannot} +\end{presentcommand} +The \cmd{bnfexpr} and the \cmd{bnfannot} commands are simply wrappers around +\cmd{texttt} and \cmd{textit}, respectively. + +\begin{presentcommand} + \env{bnfgrammar}{text} +\end{presentcommand} +The \textit{term} argument of the \texttt{bnfgrammar} environment is the term +to define a grammar. +The text inside the environment should be formatted as: +\begin{equation*} + \bnfexpr{term} \Coloneqq \langle\textit{keypairs}\rangle +\end{equation*} +where each pair of \textit{keypairs} represents an alternative syntactic form +of the \textit{term} and its annotation, delimited with a colon(\verb/:/). +If you don't need annotations, simply omit the colons and annotations +altogether. + +A sample code and the result is shown below: +\begin{exampleside} +\begin{bnfgrammar} + v ::= n | $\lambda$x.e +\end{bnfgrammar} + +\begin{bnfgrammar} + C ::= + []: hole + | C\,e: application 1 + | v\,C: application 2 + | C\,+\,e: addition 1 + | v\,+\,C: addition 2 +\end{bnfgrammar} +\end{exampleside} +\end{document} |