\chapter{The grammar of the GF language} \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 GF} \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} Integer literals \nonterminal{Int}\ are nonempty sequences of digits. 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. 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 GF are the following: \\ \begin{tabular}{lll} {\reserved{PType}} &{\reserved{Str}} &{\reserved{Strs}} \\ {\reserved{Type}} &{\reserved{abstract}} &{\reserved{case}} \\ {\reserved{cat}} &{\reserved{concrete}} &{\reserved{data}} \\ {\reserved{def}} &{\reserved{flags}} &{\reserved{fun}} \\ {\reserved{in}} &{\reserved{incomplete}} &{\reserved{instance}} \\ {\reserved{interface}} &{\reserved{let}} &{\reserved{lin}} \\ {\reserved{lincat}} &{\reserved{lindef}} &{\reserved{of}} \\ {\reserved{open}} &{\reserved{oper}} &{\reserved{param}} \\ {\reserved{pre}} &{\reserved{printname}} &{\reserved{resource}} \\ {\reserved{strs}} &{\reserved{table}} &{\reserved{transfer}} \\ {\reserved{variants}} &{\reserved{where}} &{\reserved{with}} \\ \end{tabular}\\ The symbols used in GF are the following: \\ \begin{tabular}{lll} {\symb{;}} &{\symb{{$=$}}} &{\symb{:}} \\ {\symb{{$-$}{$>$}}} &{\symb{\{}} &{\symb{\}}} \\ {\symb{**}} &{\symb{,}} &{\symb{(}} \\ {\symb{)}} &{\symb{[}} &{\symb{]}} \\ {\symb{{$-$}}} &{\symb{.}} &{\symb{{$|$}}} \\ {\symb{?}} &{\symb{{$<$}}} &{\symb{{$>$}}} \\ {\symb{@}} &{\symb{!}} &{\symb{*}} \\ {\symb{{$+$}}} &{\symb{{$+$}{$+$}}} &{\symb{$\backslash$}} \\ {\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 GF} 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{ListModDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListModDef}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{ModDef}} {\nonterminal{ListModDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ModDef}} & {\arrow} &{\nonterminal{ModDef}} {\terminal{;}} \\ & {\delimit} &{\nonterminal{ComplMod}} {\nonterminal{ModType}} {\terminal{{$=$}}} {\nonterminal{ModBody}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ModType}} & {\arrow} &{\terminal{abstract}} {\nonterminal{Ident}} \\ & {\delimit} &{\terminal{resource}} {\nonterminal{Ident}} \\ & {\delimit} &{\terminal{interface}} {\nonterminal{Ident}} \\ & {\delimit} &{\terminal{concrete}} {\nonterminal{Ident}} {\terminal{of}} {\nonterminal{Ident}} \\ & {\delimit} &{\terminal{instance}} {\nonterminal{Ident}} {\terminal{of}} {\nonterminal{Ident}} \\ & {\delimit} &{\terminal{transfer}} {\nonterminal{Ident}} {\terminal{:}} {\nonterminal{Open}} {\terminal{{$-$}{$>$}}} {\nonterminal{Open}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ModBody}} & {\arrow} &{\nonterminal{Extend}} {\nonterminal{Opens}} {\terminal{\{}} {\nonterminal{ListTopDef}} {\terminal{\}}} \\ & {\delimit} &{\nonterminal{ListIncluded}} \\ & {\delimit} &{\nonterminal{Included}} {\terminal{with}} {\nonterminal{ListOpen}} \\ & {\delimit} &{\nonterminal{Included}} {\terminal{with}} {\nonterminal{ListOpen}} {\terminal{**}} {\nonterminal{Opens}} {\terminal{\{}} {\nonterminal{ListTopDef}} {\terminal{\}}} \\ & {\delimit} &{\nonterminal{ListIncluded}} {\terminal{**}} {\nonterminal{Included}} {\terminal{with}} {\nonterminal{ListOpen}} \\ & {\delimit} &{\nonterminal{ListIncluded}} {\terminal{**}} {\nonterminal{Included}} {\terminal{with}} {\nonterminal{ListOpen}} {\terminal{**}} {\nonterminal{Opens}} {\terminal{\{}} {\nonterminal{ListTopDef}} {\terminal{\}}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListTopDef}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{TopDef}} {\nonterminal{ListTopDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Extend}} & {\arrow} &{\nonterminal{ListIncluded}} {\terminal{**}} \\ & {\delimit} &{\emptyP} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListOpen}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{Open}} \\ & {\delimit} &{\nonterminal{Open}} {\terminal{,}} {\nonterminal{ListOpen}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Opens}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\terminal{open}} {\nonterminal{ListOpen}} {\terminal{in}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Open}} & {\arrow} &{\nonterminal{Ident}} \\ & {\delimit} &{\terminal{(}} {\nonterminal{QualOpen}} {\nonterminal{Ident}} {\terminal{)}} \\ & {\delimit} &{\terminal{(}} {\nonterminal{QualOpen}} {\nonterminal{Ident}} {\terminal{{$=$}}} {\nonterminal{Ident}} {\terminal{)}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ComplMod}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\terminal{incomplete}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{QualOpen}} & {\arrow} &{\emptyP} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListIncluded}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{Included}} \\ & {\delimit} &{\nonterminal{Included}} {\terminal{,}} {\nonterminal{ListIncluded}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Included}} & {\arrow} &{\nonterminal{Ident}} \\ & {\delimit} &{\nonterminal{Ident}} {\terminal{[}} {\nonterminal{ListIdent}} {\terminal{]}} \\ & {\delimit} &{\nonterminal{Ident}} {\terminal{{$-$}}} {\terminal{[}} {\nonterminal{ListIdent}} {\terminal{]}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Def}} & {\arrow} &{\nonterminal{ListName}} {\terminal{:}} {\nonterminal{Exp}} \\ & {\delimit} &{\nonterminal{ListName}} {\terminal{{$=$}}} {\nonterminal{Exp}} \\ & {\delimit} &{\nonterminal{Name}} {\nonterminal{ListPatt}} {\terminal{{$=$}}} {\nonterminal{Exp}} \\ & {\delimit} &{\nonterminal{ListName}} {\terminal{:}} {\nonterminal{Exp}} {\terminal{{$=$}}} {\nonterminal{Exp}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{TopDef}} & {\arrow} &{\terminal{cat}} {\nonterminal{ListCatDef}} \\ & {\delimit} &{\terminal{fun}} {\nonterminal{ListFunDef}} \\ & {\delimit} &{\terminal{data}} {\nonterminal{ListFunDef}} \\ & {\delimit} &{\terminal{def}} {\nonterminal{ListDef}} \\ & {\delimit} &{\terminal{data}} {\nonterminal{ListDataDef}} \\ & {\delimit} &{\terminal{param}} {\nonterminal{ListParDef}} \\ & {\delimit} &{\terminal{oper}} {\nonterminal{ListDef}} \\ & {\delimit} &{\terminal{lincat}} {\nonterminal{ListPrintDef}} \\ & {\delimit} &{\terminal{lindef}} {\nonterminal{ListDef}} \\ & {\delimit} &{\terminal{lin}} {\nonterminal{ListDef}} \\ & {\delimit} &{\terminal{printname}} {\terminal{cat}} {\nonterminal{ListPrintDef}} \\ & {\delimit} &{\terminal{printname}} {\terminal{fun}} {\nonterminal{ListPrintDef}} \\ & {\delimit} &{\terminal{flags}} {\nonterminal{ListFlagDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{CatDef}} & {\arrow} &{\nonterminal{Ident}} {\nonterminal{ListDDecl}} \\ & {\delimit} &{\terminal{[}} {\nonterminal{Ident}} {\nonterminal{ListDDecl}} {\terminal{]}} \\ & {\delimit} &{\terminal{[}} {\nonterminal{Ident}} {\nonterminal{ListDDecl}} {\terminal{]}} {\terminal{\{}} {\nonterminal{Integer}} {\terminal{\}}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{FunDef}} & {\arrow} &{\nonterminal{ListIdent}} {\terminal{:}} {\nonterminal{Exp}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{DataDef}} & {\arrow} &{\nonterminal{Ident}} {\terminal{{$=$}}} {\nonterminal{ListDataConstr}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{DataConstr}} & {\arrow} &{\nonterminal{Ident}} \\ & {\delimit} &{\nonterminal{Ident}} {\terminal{.}} {\nonterminal{Ident}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListDataConstr}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{DataConstr}} \\ & {\delimit} &{\nonterminal{DataConstr}} {\terminal{{$|$}}} {\nonterminal{ListDataConstr}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ParDef}} & {\arrow} &{\nonterminal{Ident}} {\terminal{{$=$}}} {\nonterminal{ListParConstr}} \\ & {\delimit} &{\nonterminal{Ident}} {\terminal{{$=$}}} {\terminal{(}} {\terminal{in}} {\nonterminal{Ident}} {\terminal{)}} \\ & {\delimit} &{\nonterminal{Ident}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ParConstr}} & {\arrow} &{\nonterminal{Ident}} {\nonterminal{ListDDecl}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{PrintDef}} & {\arrow} &{\nonterminal{ListName}} {\terminal{{$=$}}} {\nonterminal{Exp}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{FlagDef}} & {\arrow} &{\nonterminal{Ident}} {\terminal{{$=$}}} {\nonterminal{Ident}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListDef}} & {\arrow} &{\nonterminal{Def}} {\terminal{;}} \\ & {\delimit} &{\nonterminal{Def}} {\terminal{;}} {\nonterminal{ListDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListCatDef}} & {\arrow} &{\nonterminal{CatDef}} {\terminal{;}} \\ & {\delimit} &{\nonterminal{CatDef}} {\terminal{;}} {\nonterminal{ListCatDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListFunDef}} & {\arrow} &{\nonterminal{FunDef}} {\terminal{;}} \\ & {\delimit} &{\nonterminal{FunDef}} {\terminal{;}} {\nonterminal{ListFunDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListDataDef}} & {\arrow} &{\nonterminal{DataDef}} {\terminal{;}} \\ & {\delimit} &{\nonterminal{DataDef}} {\terminal{;}} {\nonterminal{ListDataDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListParDef}} & {\arrow} &{\nonterminal{ParDef}} {\terminal{;}} \\ & {\delimit} &{\nonterminal{ParDef}} {\terminal{;}} {\nonterminal{ListParDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListPrintDef}} & {\arrow} &{\nonterminal{PrintDef}} {\terminal{;}} \\ & {\delimit} &{\nonterminal{PrintDef}} {\terminal{;}} {\nonterminal{ListPrintDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListFlagDef}} & {\arrow} &{\nonterminal{FlagDef}} {\terminal{;}} \\ & {\delimit} &{\nonterminal{FlagDef}} {\terminal{;}} {\nonterminal{ListFlagDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListParConstr}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{ParConstr}} \\ & {\delimit} &{\nonterminal{ParConstr}} {\terminal{{$|$}}} {\nonterminal{ListParConstr}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListIdent}} & {\arrow} &{\nonterminal{Ident}} \\ & {\delimit} &{\nonterminal{Ident}} {\terminal{,}} {\nonterminal{ListIdent}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Name}} & {\arrow} &{\nonterminal{Ident}} \\ & {\delimit} &{\terminal{[}} {\nonterminal{Ident}} {\terminal{]}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListName}} & {\arrow} &{\nonterminal{Name}} \\ & {\delimit} &{\nonterminal{Name}} {\terminal{,}} {\nonterminal{ListName}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{LocDef}} & {\arrow} &{\nonterminal{ListIdent}} {\terminal{:}} {\nonterminal{Exp}} \\ & {\delimit} &{\nonterminal{ListIdent}} {\terminal{{$=$}}} {\nonterminal{Exp}} \\ & {\delimit} &{\nonterminal{ListIdent}} {\terminal{:}} {\nonterminal{Exp}} {\terminal{{$=$}}} {\nonterminal{Exp}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListLocDef}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{LocDef}} \\ & {\delimit} &{\nonterminal{LocDef}} {\terminal{;}} {\nonterminal{ListLocDef}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Exp6}} & {\arrow} &{\nonterminal{Ident}} \\ & {\delimit} &{\nonterminal{Sort}} \\ & {\delimit} &{\nonterminal{String}} \\ & {\delimit} &{\nonterminal{Integer}} \\ & {\delimit} &{\nonterminal{Double}} \\ & {\delimit} &{\terminal{?}} \\ & {\delimit} &{\terminal{[}} {\terminal{]}} \\ & {\delimit} &{\terminal{data}} \\ & {\delimit} &{\terminal{[}} {\nonterminal{Ident}} {\nonterminal{Exps}} {\terminal{]}} \\ & {\delimit} &{\terminal{[}} {\nonterminal{String}} {\terminal{]}} \\ & {\delimit} &{\terminal{\{}} {\nonterminal{ListLocDef}} {\terminal{\}}} \\ & {\delimit} &{\terminal{{$<$}}} {\nonterminal{ListTupleComp}} {\terminal{{$>$}}} \\ & {\delimit} &{\terminal{{$<$}}} {\nonterminal{Exp}} {\terminal{:}} {\nonterminal{Exp}} {\terminal{{$>$}}} \\ & {\delimit} &{\terminal{(}} {\nonterminal{Exp}} {\terminal{)}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Exp5}} & {\arrow} &{\nonterminal{Exp5}} {\terminal{.}} {\nonterminal{Label}} \\ & {\delimit} &{\nonterminal{Exp6}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Exp4}} & {\arrow} &{\nonterminal{Exp4}} {\nonterminal{Exp5}} \\ & {\delimit} &{\terminal{table}} {\terminal{\{}} {\nonterminal{ListCase}} {\terminal{\}}} \\ & {\delimit} &{\terminal{table}} {\nonterminal{Exp6}} {\terminal{\{}} {\nonterminal{ListCase}} {\terminal{\}}} \\ & {\delimit} &{\terminal{table}} {\nonterminal{Exp6}} {\terminal{[}} {\nonterminal{ListExp}} {\terminal{]}} \\ & {\delimit} &{\terminal{case}} {\nonterminal{Exp}} {\terminal{of}} {\terminal{\{}} {\nonterminal{ListCase}} {\terminal{\}}} \\ & {\delimit} &{\terminal{variants}} {\terminal{\{}} {\nonterminal{ListExp}} {\terminal{\}}} \\ & {\delimit} &{\terminal{pre}} {\terminal{\{}} {\nonterminal{Exp}} {\terminal{;}} {\nonterminal{ListAltern}} {\terminal{\}}} \\ & {\delimit} &{\terminal{strs}} {\terminal{\{}} {\nonterminal{ListExp}} {\terminal{\}}} \\ & {\delimit} &{\nonterminal{Ident}} {\terminal{@}} {\nonterminal{Exp6}} \\ & {\delimit} &{\nonterminal{Exp5}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Exp3}} & {\arrow} &{\nonterminal{Exp3}} {\terminal{!}} {\nonterminal{Exp4}} \\ & {\delimit} &{\nonterminal{Exp3}} {\terminal{*}} {\nonterminal{Exp4}} \\ & {\delimit} &{\nonterminal{Exp3}} {\terminal{**}} {\nonterminal{Exp4}} \\ & {\delimit} &{\nonterminal{Exp4}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Exp1}} & {\arrow} &{\nonterminal{Exp2}} {\terminal{{$+$}}} {\nonterminal{Exp1}} \\ & {\delimit} &{\nonterminal{Exp2}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Exp}} & {\arrow} &{\nonterminal{Exp1}} {\terminal{{$+$}{$+$}}} {\nonterminal{Exp}} \\ & {\delimit} &{\terminal{$\backslash$}} {\nonterminal{ListBind}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}} \\ & {\delimit} &{\terminal{$\backslash$}} {\terminal{$\backslash$}} {\nonterminal{ListBind}} {\terminal{{$=$}{$>$}}} {\nonterminal{Exp}} \\ & {\delimit} &{\nonterminal{Decl}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}} \\ & {\delimit} &{\nonterminal{Exp3}} {\terminal{{$=$}{$>$}}} {\nonterminal{Exp}} \\ & {\delimit} &{\terminal{let}} {\terminal{\{}} {\nonterminal{ListLocDef}} {\terminal{\}}} {\terminal{in}} {\nonterminal{Exp}} \\ & {\delimit} &{\terminal{let}} {\nonterminal{ListLocDef}} {\terminal{in}} {\nonterminal{Exp}} \\ & {\delimit} &{\nonterminal{Exp3}} {\terminal{where}} {\terminal{\{}} {\nonterminal{ListLocDef}} {\terminal{\}}} \\ & {\delimit} &{\terminal{in}} {\nonterminal{Exp5}} {\nonterminal{String}} \\ & {\delimit} &{\nonterminal{Exp1}} \\ \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}\\ \begin{tabular}{lll} {\nonterminal{Exps}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{Exp6}} {\nonterminal{Exps}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Patt2}} & {\arrow} &{\terminal{\_}} \\ & {\delimit} &{\nonterminal{Ident}} \\ & {\delimit} &{\nonterminal{Ident}} {\terminal{.}} {\nonterminal{Ident}} \\ & {\delimit} &{\nonterminal{Integer}} \\ & {\delimit} &{\nonterminal{Double}} \\ & {\delimit} &{\nonterminal{String}} \\ & {\delimit} &{\terminal{\{}} {\nonterminal{ListPattAss}} {\terminal{\}}} \\ & {\delimit} &{\terminal{{$<$}}} {\nonterminal{ListPattTupleComp}} {\terminal{{$>$}}} \\ & {\delimit} &{\terminal{(}} {\nonterminal{Patt}} {\terminal{)}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Patt1}} & {\arrow} &{\nonterminal{Ident}} {\nonterminal{ListPatt}} \\ & {\delimit} &{\nonterminal{Ident}} {\terminal{.}} {\nonterminal{Ident}} {\nonterminal{ListPatt}} \\ & {\delimit} &{\nonterminal{Patt2}} {\terminal{*}} \\ & {\delimit} &{\nonterminal{Ident}} {\terminal{@}} {\nonterminal{Patt2}} \\ & {\delimit} &{\terminal{{$-$}}} {\nonterminal{Patt2}} \\ & {\delimit} &{\nonterminal{Patt2}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Patt}} & {\arrow} &{\nonterminal{Patt}} {\terminal{{$|$}}} {\nonterminal{Patt1}} \\ & {\delimit} &{\nonterminal{Patt}} {\terminal{{$+$}}} {\nonterminal{Patt1}} \\ & {\delimit} &{\nonterminal{Patt1}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{PattAss}} & {\arrow} &{\nonterminal{ListIdent}} {\terminal{{$=$}}} {\nonterminal{Patt}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Label}} & {\arrow} &{\nonterminal{Ident}} \\ & {\delimit} &{\terminal{\$}} {\nonterminal{Integer}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Sort}} & {\arrow} &{\terminal{Type}} \\ & {\delimit} &{\terminal{PType}} \\ & {\delimit} &{\terminal{Str}} \\ & {\delimit} &{\terminal{Strs}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListPattAss}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{PattAss}} \\ & {\delimit} &{\nonterminal{PattAss}} {\terminal{;}} {\nonterminal{ListPattAss}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListPatt}} & {\arrow} &{\nonterminal{Patt2}} \\ & {\delimit} &{\nonterminal{Patt2}} {\nonterminal{ListPatt}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Bind}} & {\arrow} &{\nonterminal{Ident}} \\ & {\delimit} &{\terminal{\_}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListBind}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{Bind}} \\ & {\delimit} &{\nonterminal{Bind}} {\terminal{,}} {\nonterminal{ListBind}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Decl}} & {\arrow} &{\terminal{(}} {\nonterminal{ListBind}} {\terminal{:}} {\nonterminal{Exp}} {\terminal{)}} \\ & {\delimit} &{\nonterminal{Exp4}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{TupleComp}} & {\arrow} &{\nonterminal{Exp}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{PattTupleComp}} & {\arrow} &{\nonterminal{Patt}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListTupleComp}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{TupleComp}} \\ & {\delimit} &{\nonterminal{TupleComp}} {\terminal{,}} {\nonterminal{ListTupleComp}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListPattTupleComp}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{PattTupleComp}} \\ & {\delimit} &{\nonterminal{PattTupleComp}} {\terminal{,}} {\nonterminal{ListPattTupleComp}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Case}} & {\arrow} &{\nonterminal{Patt}} {\terminal{{$=$}{$>$}}} {\nonterminal{Exp}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListCase}} & {\arrow} &{\nonterminal{Case}} \\ & {\delimit} &{\nonterminal{Case}} {\terminal{;}} {\nonterminal{ListCase}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{Altern}} & {\arrow} &{\nonterminal{Exp}} {\terminal{/}} {\nonterminal{Exp}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListAltern}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{Altern}} \\ & {\delimit} &{\nonterminal{Altern}} {\terminal{;}} {\nonterminal{ListAltern}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{DDecl}} & {\arrow} &{\terminal{(}} {\nonterminal{ListBind}} {\terminal{:}} {\nonterminal{Exp}} {\terminal{)}} \\ & {\delimit} &{\nonterminal{Exp6}} \\ \end{tabular}\\ \begin{tabular}{lll} {\nonterminal{ListDDecl}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{DDecl}} {\nonterminal{ListDDecl}} \\ \end{tabular}\\