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

\documentclass[a4paper,11pt]{article}
\author{BNF-converter}
\title{The Language Core}
\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 Core}

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





TMeta literals are recognized by the regular expression
\(\mbox{`?'} {\nonterminal{digit}}+\)

CIdent literals are recognized by the regular expression
\(({\nonterminal{letter}} \mid \mbox{`\_'}) ({\nonterminal{letter}} \mid {\nonterminal{digit}} \mid \mbox{`\_'} \mid \mbox{`''})*\)


\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 Core are the following: \\

\begin{tabular}{lll}
{\reserved{Type}} &{\reserved{case}} &{\reserved{data}} \\
{\reserved{in}} &{\reserved{let}} &{\reserved{of}} \\
{\reserved{rec}} &{\reserved{sig}} &{\reserved{where}} \\
\end{tabular}\\

The symbols used in Core are the following: \\

\begin{tabular}{lll}
{\symb{;}} &{\symb{:}} &{\symb{\{}} \\
{\symb{\}}} &{\symb{{$=$}}} &{\symb{(}} \\
{\symb{)}} &{\symb{\_}} &{\symb{$\backslash$}} \\
{\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 Core}
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{ListDecl}}  \\
\end{tabular}\\

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

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

\begin{tabular}{lll}
{\nonterminal{ConsDecl}} & {\arrow}  &{\nonterminal{CIdent}} {\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{ListPattern}} & {\arrow}  &{\emptyP} \\
 & {\delimit}  &{\nonterminal{Pattern}} {\nonterminal{ListPattern}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{Pattern}} & {\arrow}  &{\terminal{(}} {\nonterminal{CIdent}} {\nonterminal{ListPattern}} {\terminal{)}}  \\
 & {\delimit}  &{\nonterminal{PatternVariable}}  \\
 & {\delimit}  &{\terminal{rec}} {\terminal{\{}} {\nonterminal{ListFieldPattern}} {\terminal{\}}}  \\
 & {\delimit}  &{\terminal{Type}}  \\
 & {\delimit}  &{\nonterminal{String}}  \\
 & {\delimit}  &{\nonterminal{Integer}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{FieldPattern}} & {\arrow}  &{\nonterminal{CIdent}} {\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{PatternVariable}} & {\arrow}  &{\nonterminal{CIdent}}  \\
 & {\delimit}  &{\terminal{\_}}  \\
\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}  &{\nonterminal{Exp1}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{LetDef}} & {\arrow}  &{\nonterminal{CIdent}} {\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{Exp2}} & {\arrow}  &{\terminal{$\backslash$}} {\nonterminal{PatternVariable}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\terminal{(}} {\nonterminal{PatternVariable}} {\terminal{:}} {\nonterminal{Exp}} {\terminal{)}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}}  \\
 & {\delimit}  &{\nonterminal{Exp3}}  \\
\end{tabular}\\

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

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

\begin{tabular}{lll}
{\nonterminal{Exp5}} & {\arrow}  &{\terminal{sig}} {\terminal{\{}} {\nonterminal{ListFieldType}} {\terminal{\}}}  \\
 & {\delimit}  &{\terminal{rec}} {\terminal{\{}} {\nonterminal{ListFieldValue}} {\terminal{\}}}  \\
 & {\delimit}  &{\nonterminal{CIdent}}  \\
 & {\delimit}  &{\terminal{Type}}  \\
 & {\delimit}  &{\nonterminal{String}}  \\
 & {\delimit}  &{\nonterminal{Integer}}  \\
 & {\delimit}  &{\nonterminal{Double}}  \\
 & {\delimit}  &{\nonterminal{TMeta}}  \\
 & {\delimit}  &{\terminal{(}} {\nonterminal{Exp}} {\terminal{)}}  \\
\end{tabular}\\

\begin{tabular}{lll}
{\nonterminal{FieldType}} & {\arrow}  &{\nonterminal{CIdent}} {\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{CIdent}} {\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}\\

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



\end{document}

