%% File generated by the BNF Converter. \batchmode \documentclass[a4paper,11pt]{article} \usepackage[T1]{fontenc} \usepackage[utf8x]{inputenc} \setlength{\parindent}{0mm} \setlength{\parskip}{1mm} \title{The Language FstStudio} \author{BNF-converter} \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}. \section*{The lexical structure of FstStudio} \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. Ident literals are recognized by the regular expression \(({\nonterminal{lower}} \mid {\nonterminal{upper}}) ({\nonterminal{upper}} \mid {\nonterminal{lower}} \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 FstStudio are the following: \\ \begin{tabular}{lll} {\reserved{import}} & {\reserved{main}} & \\ \end{tabular} \\ The symbols used in FstStudio are the following: \\ \begin{tabular}{lll} {\symb{\$}} & {\symb{\&}} & {\symb{(}} \\ {\symb{)}} & {\symb{*}} & {\symb{{$+$}}} \\ {\symb{,}} & {\symb{{$-$}}} & {\symb{{$-$}{$>$}}} \\ {\symb{.\#.}} & {\symb{...}} & {\symb{.o.}} \\ {\symb{.x.}} & {\symb{//}} & {\symb{0}} \\ {\symb{:}} & {\symb{::{$=$}}} & {\symb{;}} \\ {\symb{{$<$}}} & {\symb{{$=$}{$>$}}} & {\symb{{$>$}}} \\ {\symb{?}} & {\symb{@{$-$}{$>$}}} & {\symb{$\backslash$}} \\ {\symb{{\textasciicircum}}} & {\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 FstStudio} 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{Def}} & {\arrow} &{\terminal{{$<$}}} {\nonterminal{Ident}} {\nonterminal{ListIdent}} {\terminal{{$>$}}} {\terminal{::{$=$}}} {\nonterminal{Exp}} \\ & {\delimit} &{\terminal{import}} {\nonterminal{ListIdent}} \\ & {\delimit} &{\terminal{{$<$}}} {\terminal{main}} {\terminal{{$>$}}} {\terminal{::{$=$}}} {\nonterminal{Exp}} \\ \end{tabular} \\ \begin{tabular}{lll} {\nonterminal{Exp}} & {\arrow} &{\nonterminal{Exp}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp1}} {\terminal{{$|$}{$|$}}} {\nonterminal{Exp1}} {\terminal{\_}} {\nonterminal{Exp1}} \\ & {\delimit} &{\nonterminal{Exp}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp1}} {\terminal{//}} {\nonterminal{Exp1}} {\terminal{\_}} {\nonterminal{Exp1}} \\ & {\delimit} &{\nonterminal{Exp}} {\terminal{.o.}} {\nonterminal{Exp1}} \\ & {\delimit} &{\nonterminal{Exp}} {\terminal{.x.}} {\nonterminal{Exp1}} \\ & {\delimit} &{\nonterminal{Exp}} {\terminal{@{$-$}{$>$}}} {\nonterminal{Exp1}} \\ & {\delimit} &{\nonterminal{Exp}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp1}} \\ & {\delimit} &{\nonterminal{Exp}} {\terminal{{$=$}{$>$}}} {\nonterminal{Exp1}} {\terminal{\_}} {\nonterminal{Exp1}} \\ & {\delimit} &{\nonterminal{Exp1}} \\ \end{tabular} \\ \begin{tabular}{lll} {\nonterminal{Program}} & {\arrow} &{\nonterminal{ListDef}} \\ \end{tabular} \\ \begin{tabular}{lll} {\nonterminal{ListIdent}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\terminal{,}} {\nonterminal{Ident}} {\nonterminal{ListIdent}} \\ \end{tabular} \\ \begin{tabular}{lll} {\nonterminal{ListDef}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\nonterminal{Def}} {\terminal{;}} {\nonterminal{ListDef}} \\ \end{tabular} \\ \begin{tabular}{lll} {\nonterminal{ListExp}} & {\arrow} &{\emptyP} \\ & {\delimit} &{\terminal{,}} {\nonterminal{Exp}} {\nonterminal{ListExp}} \\ \end{tabular} \\ \begin{tabular}{lll} {\nonterminal{Exp1}} & {\arrow} &{\nonterminal{Exp1}} {\terminal{\&}} {\nonterminal{Exp2}} \\ & {\delimit} &{\nonterminal{Exp2}} {\terminal{...}} {\nonterminal{Exp2}} \\ & {\delimit} &{\nonterminal{Exp1}} {\terminal{{$-$}}} {\nonterminal{Exp2}} \\ & {\delimit} &{\nonterminal{Exp1}} {\terminal{{$|$}}} {\nonterminal{Exp2}} \\ & {\delimit} &{\nonterminal{Exp2}} \\ \end{tabular} \\ \begin{tabular}{lll} {\nonterminal{Exp2}} & {\arrow} &{\nonterminal{Exp2}} {\nonterminal{Exp3}} \\ & {\delimit} &{\nonterminal{Exp3}} \\ \end{tabular} \\ \begin{tabular}{lll} {\nonterminal{Exp3}} & {\arrow} &{\terminal{\~{}}} {\nonterminal{Exp4}} \\ & {\delimit} &{\terminal{\$}} {\nonterminal{Exp4}} \\ & {\delimit} &{\terminal{$\backslash$}} {\nonterminal{Exp4}} \\ & {\delimit} &{\nonterminal{Exp4}} \\ \end{tabular} \\ \begin{tabular}{lll} {\nonterminal{Exp4}} & {\arrow} &{\terminal{?}} \\ & {\delimit} &{\terminal{{$<$}}} {\nonterminal{Ident}} {\nonterminal{ListExp}} {\terminal{{$>$}}} \\ & {\delimit} &{\terminal{.\#.}} \\ & {\delimit} &{\terminal{\{}} {\nonterminal{String}} {\terminal{\}}} \\ & {\delimit} &{\terminal{0}} \\ & {\delimit} &{\nonterminal{Exp4}} {\terminal{{\textasciicircum}}} {\nonterminal{Integer}} \\ & {\delimit} &{\nonterminal{Exp4}} {\terminal{{$+$}}} \\ & {\delimit} &{\nonterminal{String}} {\terminal{:}} {\nonterminal{String}} \\ & {\delimit} &{\nonterminal{Exp4}} {\terminal{*}} \\ & {\delimit} &{\nonterminal{String}} \\ & {\delimit} &{\nonterminal{Ident}} \\ & {\delimit} &{\terminal{(}} {\nonterminal{Exp}} {\terminal{)}} \\ \end{tabular} \\ \end{document}