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


Double-precision float literals \nonterminal{Double}\ have the structure
indicated by the regular expression $\nonterminal{digit}+ \mbox{{\it `.'}} \nonterminal{digit}+ (\mbox{{\it `e'}} \mbox{{\it `-'}}? \nonterminal{digit}+)?$ i.e.\
two sequences of digits separated by a decimal point, optionally
followed by an unsigned or negative exponent.




\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{do}} &{\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{)}} &{\symb{[}} &{\symb{]}} \\
{\symb{,}} &{\symb{\_}} &{\symb{{$-$}{$>$}}} \\
{\symb{$\backslash$}} &{\symb{{$<$}{$-$}}} &{\symb{{$>$}{$>$}{$=$}}} \\
{\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}} {\nonterminal{Guard}} {\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{Guard}} & {\arrow}  &{\terminal{{$|$}}} {\nonterminal{Exp1}}  \\
 & {\delimit}  &{\emptyP} \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Pattern}} & {\arrow}  &{\nonterminal{Pattern1}} {\terminal{{$|$}{$|$}}} {\nonterminal{Pattern}}  \\
 & {\delimit}  &{\nonterminal{Pattern1}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Pattern1}} & {\arrow}  &{\nonterminal{Pattern2}} {\terminal{::}} {\nonterminal{Pattern1}}  \\
 & {\delimit}  &{\nonterminal{Pattern2}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Pattern2}} & {\arrow}  &{\nonterminal{Ident}} {\nonterminal{Pattern3}} {\nonterminal{ListPattern}}  \\
 & {\delimit}  &{\nonterminal{Pattern3}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Pattern3}} & {\arrow}  &{\terminal{rec}} {\terminal{\{}} {\nonterminal{ListFieldPattern}} {\terminal{\}}}  \\
 & {\delimit}  &{\terminal{[}} {\nonterminal{ListPListElem}} {\terminal{]}}  \\
 & {\delimit}  &{\terminal{Type}}  \\
 & {\delimit}  &{\nonterminal{String}}  \\
 & {\delimit}  &{\nonterminal{Integer}}  \\
 & {\delimit}  &{\nonterminal{Ident}}  \\
 & {\delimit}  &{\terminal{\_}}  \\
 & {\delimit}  &{\terminal{(}} {\nonterminal{Pattern}} {\terminal{)}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{PListElem}} & {\arrow}  &{\nonterminal{Pattern}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListPListElem}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{PListElem}}  \\
 & {\delimit}  &{\nonterminal{PListElem}} {\terminal{,}} {\nonterminal{ListPListElem}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListPattern}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{Pattern3}} {\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{(}} {\nonterminal{VarOrWild}} {\terminal{:}} {\nonterminal{Exp}} {\terminal{)}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\nonterminal{Exp1}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\nonterminal{Exp1}}  \\
\end{tabular}\\

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

\begin{tabular}{lll}
{\nonterminal{Exp1}} & {\arrow}  &{\terminal{$\backslash$}} {\nonterminal{VarOrWild}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp1}}  \\
 & {\delimit}  &{\terminal{let}} {\terminal{\{}} {\nonterminal{ListLetDef}} {\terminal{\}}} {\terminal{in}} {\nonterminal{Exp1}}  \\
 & {\delimit}  &{\terminal{case}} {\nonterminal{Exp}} {\terminal{of}} {\terminal{\{}} {\nonterminal{ListCase}} {\terminal{\}}}  \\
 & {\delimit}  &{\terminal{if}} {\nonterminal{Exp}} {\terminal{then}} {\nonterminal{Exp}} {\terminal{else}} {\nonterminal{Exp1}}  \\
 & {\delimit}  &{\terminal{do}} {\terminal{\{}} {\nonterminal{ListBind}} {\nonterminal{Exp}} {\terminal{\}}}  \\
 & {\delimit}  &{\nonterminal{Exp2}}  \\
\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}} {\nonterminal{Guard}} {\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{Bind}} & {\arrow}  &{\nonterminal{VarOrWild}} {\terminal{{$<$}{$-$}}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\nonterminal{Exp}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListBind}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{Bind}} {\terminal{;}} {\nonterminal{ListBind}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp3}} & {\arrow}  &{\nonterminal{Exp3}} {\terminal{{$>$}{$>$}{$=$}}} {\nonterminal{Exp4}}  \\
 & {\delimit}  &{\nonterminal{Exp3}} {\terminal{{$>$}{$>$}}} {\nonterminal{Exp4}}  \\
 & {\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{Exp5}}  \\
 & {\delimit}  &{\nonterminal{Exp6}}  \\
\end{tabular}\\

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

\begin{tabular}{lll}
{\nonterminal{Exp7}} & {\arrow}  &{\nonterminal{Exp8}} {\terminal{::}} {\nonterminal{Exp7}}  \\
 & {\delimit}  &{\nonterminal{Exp8}}  \\
\end{tabular}\\

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

\begin{tabular}{lll}
{\nonterminal{Exp9}} & {\arrow}  &{\nonterminal{Exp9}} {\terminal{*}} {\nonterminal{Exp10}}  \\
 & {\delimit}  &{\nonterminal{Exp9}} {\terminal{/}} {\nonterminal{Exp10}}  \\
 & {\delimit}  &{\nonterminal{Exp9}} {\terminal{\%}} {\nonterminal{Exp10}}  \\
 & {\delimit}  &{\nonterminal{Exp10}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp10}} & {\arrow}  &{\terminal{{$-$}}} {\nonterminal{Exp10}}  \\
 & {\delimit}  &{\nonterminal{Exp11}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp11}} & {\arrow}  &{\nonterminal{Exp11}} {\nonterminal{Exp12}}  \\
 & {\delimit}  &{\nonterminal{Exp12}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp12}} & {\arrow}  &{\nonterminal{Exp12}} {\terminal{.}} {\nonterminal{Ident}}  \\
 & {\delimit}  &{\nonterminal{Exp13}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Exp13}} & {\arrow}  &{\terminal{sig}} {\terminal{\{}} {\nonterminal{ListFieldType}} {\terminal{\}}}  \\
 & {\delimit}  &{\terminal{rec}} {\terminal{\{}} {\nonterminal{ListFieldValue}} {\terminal{\}}}  \\
 & {\delimit}  &{\terminal{[}} {\nonterminal{ListExp}} {\terminal{]}}  \\
 & {\delimit}  &{\nonterminal{Ident}}  \\
 & {\delimit}  &{\terminal{Type}}  \\
 & {\delimit}  &{\nonterminal{String}}  \\
 & {\delimit}  &{\nonterminal{Integer}}  \\
 & {\delimit}  &{\nonterminal{Double}}  \\
 & {\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{Exp2}} & {\arrow}  &{\nonterminal{Exp3}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{ListExp}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{Exp}}  \\
 & {\delimit}  &{\nonterminal{Exp}} {\terminal{,}} {\nonterminal{ListExp}}  \\
\end{tabular}\\



\end{document}

