diff options
| author | bringert <bringert@cs.chalmers.se> | 2005-11-25 16:36:19 +0000 |
|---|---|---|
| committer | bringert <bringert@cs.chalmers.se> | 2005-11-25 16:36:19 +0000 |
| commit | dbe8e61acc616b8f5ac07e8df89eb98a7997c29d (patch) | |
| tree | 6e379f18986fc60f5606e023def46abdf770dca5 /src/Transfer/Core/Doc.tex | |
| parent | fe2731e5f8e301b5a0169bf8b667bb6c13bae80b (diff) | |
Move transfer into the GF repo.
Diffstat (limited to 'src/Transfer/Core/Doc.tex')
| -rw-r--r-- | src/Transfer/Core/Doc.tex | 203 |
1 files changed, 203 insertions, 0 deletions
diff --git a/src/Transfer/Core/Doc.tex b/src/Transfer/Core/Doc.tex new file mode 100644 index 000000000..431aa1e54 --- /dev/null +++ b/src/Transfer/Core/Doc.tex @@ -0,0 +1,203 @@ +\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. + + + + +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{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{\{}} {\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{\{}} {\terminal{\}}} \\ + & {\delimit} &{\terminal{\{}} {\nonterminal{ListFieldType}} {\terminal{\}}} \\ + & {\delimit} &{\terminal{\{}} {\nonterminal{ListFieldValue}} {\terminal{\}}} \\ + & {\delimit} &{\nonterminal{CIdent}} \\ + & {\delimit} &{\terminal{Type}} \\ + & {\delimit} &{\nonterminal{String}} \\ + & {\delimit} &{\nonterminal{Integer}} \\ + & {\delimit} &{\terminal{(}} {\nonterminal{Exp}} {\terminal{)}} \\ +\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}\\ + +\begin{tabular}{lll} +{\nonterminal{FieldType}} & {\arrow} &{\nonterminal{CIdent}} {\terminal{:}} {\nonterminal{Exp}} \\ +\end{tabular}\\ + +\begin{tabular}{lll} +{\nonterminal{ListFieldType}} & {\arrow} &{\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} &{\nonterminal{FieldValue}} \\ + & {\delimit} &{\nonterminal{FieldValue}} {\terminal{;}} {\nonterminal{ListFieldValue}} \\ +\end{tabular}\\ + + + +\end{document} + |
