\documentclass[a4paper]{article}

\usepackage{simplebnf}
\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=.5\textwidth} }
  { \endtcblisting }

\NewDocumentCommand \cmd { m } {\texttt{\textbackslash#1}}

\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 \env { m m }
  {
    \texttt{%
      \textbackslash begin\{#1\} \textrm{#2}%
      \textbackslash end\{#1\}%
    }%
  }

\title{%
  \textsf{simplebnf} --- A simple package to format Backus-Naur form%
  \footnote{This file describes v0.2.0.}}
\author{Jay Lee\footnote{E-mail: %
  \href{mailto:jaeho.lee@snu.ac.kr}{\texttt{jaeho.lee@snu.ac.kr}}}}
\date{2020/09/01}

\begin{document}
\maketitle

This package provides a simple way to typeset grammars written in Backus-Naur form (BNF).

\begin{presentcommand}
  \cmd{bnfexpr} \cmd{bnfannot}
\end{presentcommand}
These commands are wrappers around \cmd{texttt} and \cmd{textit} respectively.

\begin{presentcommand}
  \env{bnfgrammar}{text}
\end{presentcommand}
can be used to typeset BNF grammars. The \textit{text} inside the environment should be formatted as:
\begin{verbatim}
  term1 ::= rhs1
  ;;
  term2 ::= rhs2
  ;;
  ...
  termk ::= rhsk
\end{verbatim}
where each of the \textit{rhs} represents alternative syntactic forms of the \textit{term}. An annotation may accompany each alternative in which case the alternative must be separated from its annotation with a colon (\verb/:/). If you don't need annotations, simply omit the colons and annotations altogether. The alternatives themselves are separated using the pipe symbol (\verb/|/).

A sample code and the result is shown below:
\begin{exampleside}
  \begin{bnfgrammar}
    expr ::=
      expr + term : sum
    | term        : term
    ;;
    term ::=
      term * a : product
    | a        : variable
  \end{bnfgrammar}
\end{exampleside}
\end{document}