\begin{figure}
\begin{minipage}[l]{0.4\textwidth}
\large
\begin{center}
\textbf{Appendix}

\ \\
\textbf{LBNF Specification}
\end{center}

\scriptsize

This document was automatically generated by the {\em BNF-Converter}. 
It was generated together with the lexer, the parser, and the abstract 
syntax module, which guarantees that the document matches with the 
implementation of the language (provided no hand-hacking has taken place).

\normalsize

\textbf{The lexical structure of LBNF}

\textbf{Identifiers}

\scriptsize
Identifiers \nonterminal{Ident} are unquoted strings beginning with a letter,
followed by any combination of letters, digits, and the characters {\tt \_ '},
reserved words excluded.

\normalsize
\textbf{Literals}

\scriptsize
String literals \nonterminal{String}\ have the form
\terminal{"}$x$\terminal{"}, where $x$ is any sequence of any characters
except \terminal{"}\ unless preceded by \verb6\6.


Integer literals \nonterminal{Int}\ are nonempty sequences of digits.


Character literals \nonterminal{Char}\ have the form
\terminal{'}$c$\terminal{'}, where $c$ is any single character.

\normalsize

\textbf{Reserved words and symbols}

\scriptsize
The set of reserved words is the set of terminals appearing in the grammar. Those reserved words that consist of non-letter characters are called symbols, and they are treated in a different way from those that are similar to identifiers. The lexer follows rules familiar from languages like Haskell, C, and Java, including longest match and spacing conventions.

The reserved words used in LBNF are the following: \\

\begin{tabular}{lll}
{\reserved{char}} &{\reserved{coercions}} &{\reserved{comment}} \\
{\reserved{digit}} &{\reserved{entrypoints}} &{\reserved{eps}} \\
{\reserved{internal}} &{\reserved{layout}} &{\reserved{letter}} \\
{\reserved{lower}} &{\reserved{nonempty}} &{\reserved{rules}} \\
{\reserved{separator}} &{\reserved{stop}} &{\reserved{terminator}} \\
{\reserved{token}} &{\reserved{toplevel}} &{\reserved{upper}} \\
\end{tabular}\\

The symbols used in LBNF are the following: \\

\begin{tabular}{lll}
{\symb{;}} &{\symb{.}} &{\symb{::{$=$}}} \\
{\symb{[}} &{\symb{]}} &{\symb{ \_ }} \\
{\symb{(}} &{\symb{:}} &{\symb{)}} \\
{\symb{,}} &{\symb{{$|$}}} &{\symb{{$-$}}} \\
{\symb{*}} &{\symb{{$+$}}} &{\symb{?}} \\
{\symb{\{}} &{\symb{\}}} & \\
\end{tabular}\\

\normalsize

\textbf{Comments}

\scriptsize
Single-line comments begin with {\symb{{$-$}{$-$}}}. \\Multiple-line comments are  enclosed with {\symb{\{ {$-$}}} and {\symb{{$-$} \} }}.

\end{minipage}
\hfill
\begin{minipage}[r]{0.5\textwidth}

\textbf{The syntactic structure of LBNF}

\scriptsize
Non-terminals are enclosed between $\langle$ and $\rangle$. 
The symbols  {\arrow}  (production),  {\delimit}  (union) 
and {\emptyP} (empty rule) belong to the BNF notation. 
All other symbols are terminals.\\

\begin{tabular}{lll}
{\nonterminal{Grammar}} & {\arrow}  &{\nonterminal{ListDef}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListDef}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{Def}} {\terminal{;}} {\nonterminal{ListDef}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListItem}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{Item}} {\nonterminal{ListItem}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Def}} & {\arrow}  &{\nonterminal{Label}} {\terminal{.}} {\nonterminal{Cat}} {\terminal{::{$=$}}} {\nonterminal{ListItem}}  \\
 & {\delimit}  &{\terminal{comment}} {\nonterminal{String}}  \\
 & {\delimit}  &{\terminal{comment}} {\nonterminal{String}} {\nonterminal{String}}  \\
 & {\delimit}  &{\terminal{internal}} {\nonterminal{Label}} {\terminal{.}} {\nonterminal{Cat}} {\terminal{::{$=$}}} {\nonterminal{ListItem}}  \\
 & {\delimit}  &{\terminal{token}} {\nonterminal{Ident}} {\nonterminal{Reg}}  \\
 & {\delimit}  &{\terminal{entrypoints}} {\nonterminal{ListIdent}}  \\
 & {\delimit}  &{\terminal{separator}} {\nonterminal{MinimumSize}} {\nonterminal{Cat}} {\nonterminal{String}}  \\
 & {\delimit}  &{\terminal{terminator}} {\nonterminal{MinimumSize}} {\nonterminal{Cat}} {\nonterminal{String}}  \\
 & {\delimit}  &{\terminal{coercions}} {\nonterminal{Ident}} {\nonterminal{Integer}}  \\
 & {\delimit}  &{\terminal{rules}} {\nonterminal{Ident}} {\terminal{::{$=$}}} {\nonterminal{ListRHS}}  \\
 & {\delimit}  &{\terminal{layout}} {\nonterminal{ListString}}  \\
 & {\delimit}  &{\terminal{layout}} {\terminal{stop}} {\nonterminal{ListString}}  \\
 & {\delimit}  &{\terminal{layout}} {\terminal{toplevel}}  \\
\end{tabular}\\
  
  \begin{tabular}{lll}
    {\nonterminal{Item}} & {\arrow}  &{\nonterminal{String}}  \\
    & {\delimit}  &{\nonterminal{Cat}}  \\
  \end{tabular}\\
  
  \begin{tabular}{lll}
 {\nonterminal{Cat}} & {\arrow}  &{\terminal{[}} {\nonterminal{Cat}} {\terminal{]}}  \\
  & {\delimit}  &{\nonterminal{Ident}}  \\
 \end{tabular}\\

 \begin{tabular}{lll}
 {\nonterminal{Label}} & {\arrow}  &{\nonterminal{Ident}}  \\
  & {\delimit}  &{\terminal{ \_ }}  \\
  & {\delimit}  &{\terminal{[}} {\terminal{]}}  \\
  & {\delimit}  &{\terminal{(}} {\terminal{:}} {\terminal{)}}  \\
  & {\delimit}  &{\terminal{(}} {\terminal{:}} {\terminal{[}} {\terminal{]}} {\terminal{)}}  \\
 \end{tabular}\\

 \begin{tabular}{lll}
 {\nonterminal{ListString}} & {\arrow}  &{\nonterminal{String}}  \\
  & {\delimit}  &{\nonterminal{String}} {\terminal{,}} {\nonterminal{ListString}}  \\
 \end{tabular}\\

 \begin{tabular}{lll}
 {\nonterminal{ListRHS}} & {\arrow}  &{\nonterminal{RHS}}  \\
  & {\delimit}  &{\nonterminal{RHS}} {\terminal{{$|$}}} {\nonterminal{ListRHS}}  \\
 \end{tabular}\\

 \begin{tabular}{lll}
 {\nonterminal{RHS}} & {\arrow}  &{\nonterminal{ListItem}}  \\
 \end{tabular}\\

 \begin{tabular}{lll}
 {\nonterminal{MinimumSize}} & {\arrow}  &{\terminal{nonempty}}  \\
  & {\delimit}  &{\emptyP} \\
 \end{tabular}\\

 \begin{tabular}{lll}
 {\nonterminal{Reg2}} & {\arrow}  &{\nonterminal{Reg2}} {\nonterminal{Reg3}}  \\
  & {\delimit}  &{\nonterminal{Reg3}}  \\
 \end{tabular}\\

 \begin{tabular}{lll}
 {\nonterminal{Reg1}} & {\arrow}  &{\nonterminal{Reg1}} {\terminal{{$|$}}} {\nonterminal{Reg2}}  \\
  & {\delimit}  &{\nonterminal{Reg2}} {\terminal{{$-$}}} {\nonterminal{Reg2}}  \\
  & {\delimit}  &{\nonterminal{Reg2}}  \\
 \end{tabular}\\

 \begin{tabular}{lll}
 {\nonterminal{Reg3}} & {\arrow}  &{\nonterminal{Reg3}} {\terminal{*}}  \\
  & {\delimit}  &{\nonterminal{Reg3}} {\terminal{{$+$}}}  \\
  & {\delimit}  &{\nonterminal{Reg3}} {\terminal{?}}  \\
  & {\delimit}  &{\terminal{eps}}  \\
  & {\delimit}  &{\nonterminal{Char}}  \\
  & {\delimit}  &{\terminal{[}} {\nonterminal{String}} {\terminal{]}}  \\
  & {\delimit}  &{\terminal{\{}} {\nonterminal{String}} {\terminal{\}}}  \\
  & {\delimit}  &{\terminal{digit}}  \\
  & {\delimit}  &{\terminal{letter}}  \\
  & {\delimit}  &{\terminal{upper}}  \\
  & {\delimit}  &{\terminal{lower}}  \\
  & {\delimit}  &{\terminal{char}}  \\
  & {\delimit}  &{\terminal{(}} {\nonterminal{Reg}} {\terminal{)}}  \\
 \end{tabular}\\

 \begin{tabular}{lll}
 {\nonterminal{Reg}} & {\arrow}  &{\nonterminal{Reg1}}  \\
 \end{tabular}\\

 \begin{tabular}{lll}
 {\nonterminal{ListIdent}} & {\arrow}  &{\nonterminal{Ident}}  \\
  & {\delimit}  &{\nonterminal{Ident}} {\terminal{,}} {\nonterminal{ListIdent}}  \\
 \end{tabular}\\
\hfill
 \end{minipage}

%\caption{LBNF Specification}
\label{fig:lbnf}
\end{figure}
