\batchmode
%This Latex file is machine-generated by the BNF-converter

\documentclass[a4paper,11pt]{article}
\author{BNF-converter}
\title{The Language Syntax}
\setlength{\parindent}{0mm}
\setlength{\parskip}{1mm}
\begin{document}

\maketitle

\newcommand{\emptyP}{\mbox{$\epsilon$}}
\newcommand{\terminal}[1]{\mbox{{\texttt {#1}}}}
\newcommand{\nonterminal}[1]{\mbox{$\langle \mbox{{\sl #1 }} \! \rangle$}}
\newcommand{\arrow}{\mbox{::=}}
\newcommand{\delimit}{\mbox{$|$}}
\newcommand{\reserved}[1]{\mbox{{\texttt {#1}}}}
\newcommand{\literal}[1]{\mbox{{\texttt {#1}}}}
\newcommand{\symb}[1]{\mbox{{\texttt {#1}}}}

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).

\section*{The lexical structure of Syntax}
\subsection*{Identifiers}
Identifiers \nonterminal{Ident} are unquoted strings beginning with a letter,
followed by any combination of letters, digits, and the characters {\tt \_ '},
reserved words excluded.


\subsection*{Literals}
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.




\subsection*{Reserved words and symbols}
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 Syntax are the following: \\

\begin{tabular}{lll}
{\reserved{Type}} &{\reserved{case}} &{\reserved{data}} \\
{\reserved{derive}} &{\reserved{else}} &{\reserved{if}} \\
{\reserved{import}} &{\reserved{in}} &{\reserved{let}} \\
{\reserved{of}} &{\reserved{rec}} &{\reserved{sig}} \\
{\reserved{then}} &{\reserved{where}} & \\
\end{tabular}\\

The symbols used in Syntax are the following: \\

\begin{tabular}{lll}
{\symb{;}} &{\symb{:}} &{\symb{\{}} \\
{\symb{\}}} &{\symb{{$=$}}} &{\symb{(}} \\
{\symb{)}} &{\symb{\_}} &{\symb{{$-$}{$>$}}} \\
{\symb{$\backslash$}} &{\symb{{$|$}{$|$}}} &{\symb{\&\&}} \\
{\symb{{$=$}{$=$}}} &{\symb{/{$=$}}} &{\symb{{$<$}}} \\
{\symb{{$<$}{$=$}}} &{\symb{{$>$}}} &{\symb{{$>$}{$=$}}} \\
{\symb{{$+$}}} &{\symb{{$-$}}} &{\symb{*}} \\
{\symb{/}} &{\symb{\%}} &{\symb{.}} \\
{\symb{?}} & & \\
\end{tabular}\\

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

\section*{The syntactic structure of Syntax}
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{Module}} & {\arrow}  &{\nonterminal{ListImport}} {\nonterminal{ListDecl}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Import}} & {\arrow}  &{\terminal{import}} {\nonterminal{Ident}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListImport}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{Import}}  \\
 & {\delimit}  &{\nonterminal{Import}} {\terminal{;}} {\nonterminal{ListImport}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Decl}} & {\arrow}  &{\terminal{data}} {\nonterminal{Ident}} {\terminal{:}} {\nonterminal{Exp}} {\terminal{where}} {\terminal{\{}} {\nonterminal{ListConsDecl}} {\terminal{\}}}  \\
 & {\delimit}  &{\nonterminal{Ident}} {\terminal{:}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\nonterminal{Ident}} {\nonterminal{ListPattern}} {\terminal{{$=$}}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\terminal{derive}} {\nonterminal{Ident}} {\nonterminal{Ident}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListDecl}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{Decl}}  \\
 & {\delimit}  &{\nonterminal{Decl}} {\terminal{;}} {\nonterminal{ListDecl}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ConsDecl}} & {\arrow}  &{\nonterminal{Ident}} {\terminal{:}} {\nonterminal{Exp}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListConsDecl}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{ConsDecl}}  \\
 & {\delimit}  &{\nonterminal{ConsDecl}} {\terminal{;}} {\nonterminal{ListConsDecl}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Pattern}} & {\arrow}  &{\nonterminal{Ident}} {\nonterminal{Pattern1}} {\nonterminal{ListPattern}}  \\
 & {\delimit}  &{\nonterminal{Pattern1}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Pattern1}} & {\arrow}  &{\terminal{(}} {\nonterminal{Ident}} {\nonterminal{ListPattern}} {\terminal{)}}  \\
 & {\delimit}  &{\terminal{rec}} {\terminal{\{}} {\nonterminal{ListFieldPattern}} {\terminal{\}}}  \\
 & {\delimit}  &{\terminal{Type}}  \\
 & {\delimit}  &{\nonterminal{String}}  \\
 & {\delimit}  &{\nonterminal{Integer}}  \\
 & {\delimit}  &{\nonterminal{Ident}}  \\
 & {\delimit}  &{\terminal{\_}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListPattern}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{Pattern1}} {\nonterminal{ListPattern}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{FieldPattern}} & {\arrow}  &{\nonterminal{Ident}} {\terminal{{$=$}}} {\nonterminal{Pattern}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListFieldPattern}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{FieldPattern}}  \\
 & {\delimit}  &{\nonterminal{FieldPattern}} {\terminal{;}} {\nonterminal{ListFieldPattern}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp}} & {\arrow}  &{\terminal{let}} {\terminal{\{}} {\nonterminal{ListLetDef}} {\terminal{\}}} {\terminal{in}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\terminal{case}} {\nonterminal{Exp}} {\terminal{of}} {\terminal{\{}} {\nonterminal{ListCase}} {\terminal{\}}}  \\
 & {\delimit}  &{\terminal{if}} {\nonterminal{Exp}} {\terminal{then}} {\nonterminal{Exp}} {\terminal{else}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\nonterminal{Exp1}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{LetDef}} & {\arrow}  &{\nonterminal{Ident}} {\terminal{:}} {\nonterminal{Exp}} {\terminal{{$=$}}} {\nonterminal{Exp}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListLetDef}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{LetDef}}  \\
 & {\delimit}  &{\nonterminal{LetDef}} {\terminal{;}} {\nonterminal{ListLetDef}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Case}} & {\arrow}  &{\nonterminal{Pattern}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListCase}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{Case}}  \\
 & {\delimit}  &{\nonterminal{Case}} {\terminal{;}} {\nonterminal{ListCase}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp2}} & {\arrow}  &{\terminal{$\backslash$}} {\nonterminal{VarOrWild}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\terminal{(}} {\nonterminal{VarOrWild}} {\terminal{:}} {\nonterminal{Exp}} {\terminal{)}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\nonterminal{Exp3}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\nonterminal{Exp3}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{VarOrWild}} & {\arrow}  &{\nonterminal{Ident}}  \\
 & {\delimit}  &{\terminal{\_}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp3}} & {\arrow}  &{\nonterminal{Exp4}} {\terminal{{$|$}{$|$}}} {\nonterminal{Exp3}}  \\
 & {\delimit}  &{\nonterminal{Exp4}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp4}} & {\arrow}  &{\nonterminal{Exp5}} {\terminal{\&\&}} {\nonterminal{Exp4}}  \\
 & {\delimit}  &{\nonterminal{Exp5}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp5}} & {\arrow}  &{\nonterminal{Exp6}} {\terminal{{$=$}{$=$}}} {\nonterminal{Exp6}}  \\
 & {\delimit}  &{\nonterminal{Exp6}} {\terminal{/{$=$}}} {\nonterminal{Exp6}}  \\
 & {\delimit}  &{\nonterminal{Exp6}} {\terminal{{$<$}}} {\nonterminal{Exp6}}  \\
 & {\delimit}  &{\nonterminal{Exp6}} {\terminal{{$<$}{$=$}}} {\nonterminal{Exp6}}  \\
 & {\delimit}  &{\nonterminal{Exp6}} {\terminal{{$>$}}} {\nonterminal{Exp6}}  \\
 & {\delimit}  &{\nonterminal{Exp6}} {\terminal{{$>$}{$=$}}} {\nonterminal{Exp6}}  \\
 & {\delimit}  &{\nonterminal{Exp6}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp6}} & {\arrow}  &{\nonterminal{Exp6}} {\terminal{{$+$}}} {\nonterminal{Exp7}}  \\
 & {\delimit}  &{\nonterminal{Exp6}} {\terminal{{$-$}}} {\nonterminal{Exp7}}  \\
 & {\delimit}  &{\nonterminal{Exp7}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp7}} & {\arrow}  &{\nonterminal{Exp7}} {\terminal{*}} {\nonterminal{Exp8}}  \\
 & {\delimit}  &{\nonterminal{Exp7}} {\terminal{/}} {\nonterminal{Exp8}}  \\
 & {\delimit}  &{\nonterminal{Exp7}} {\terminal{\%}} {\nonterminal{Exp8}}  \\
 & {\delimit}  &{\nonterminal{Exp8}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp8}} & {\arrow}  &{\terminal{{$-$}}} {\nonterminal{Exp8}}  \\
 & {\delimit}  &{\nonterminal{Exp9}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp9}} & {\arrow}  &{\nonterminal{Exp9}} {\nonterminal{Exp10}}  \\
 & {\delimit}  &{\nonterminal{Exp10}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp10}} & {\arrow}  &{\nonterminal{Exp10}} {\terminal{.}} {\nonterminal{Ident}}  \\
 & {\delimit}  &{\nonterminal{Exp11}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp11}} & {\arrow}  &{\terminal{sig}} {\terminal{\{}} {\nonterminal{ListFieldType}} {\terminal{\}}}  \\
 & {\delimit}  &{\terminal{rec}} {\terminal{\{}} {\nonterminal{ListFieldValue}} {\terminal{\}}}  \\
 & {\delimit}  &{\nonterminal{Ident}}  \\
 & {\delimit}  &{\terminal{Type}}  \\
 & {\delimit}  &{\nonterminal{String}}  \\
 & {\delimit}  &{\nonterminal{Integer}}  \\
 & {\delimit}  &{\terminal{?}}  \\
 & {\delimit}  &{\terminal{(}} {\nonterminal{Exp}} {\terminal{)}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{FieldType}} & {\arrow}  &{\nonterminal{Ident}} {\terminal{:}} {\nonterminal{Exp}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListFieldType}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{FieldType}}  \\
 & {\delimit}  &{\nonterminal{FieldType}} {\terminal{;}} {\nonterminal{ListFieldType}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{FieldValue}} & {\arrow}  &{\nonterminal{Ident}} {\terminal{{$=$}}} {\nonterminal{Exp}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListFieldValue}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{FieldValue}}  \\
 & {\delimit}  &{\nonterminal{FieldValue}} {\terminal{;}} {\nonterminal{ListFieldValue}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp1}} & {\arrow}  &{\nonterminal{Exp2}}  \\
\end{tabular}\\



\end{document}

