\chapter{Preamble: the descriptional formalism}\label{ch:formalism}
This very short chapter is a preparatory chapter for the next
chapter, introducing the notation in which
the syntax of the \agfl\ formalism will be described. Readers familiar
with W-grammar notation may skip it. Please note it does
NOT describe the \agfl\ formalism itself -- that happens in the next
chapter.

\section{Notational conventions}
\label{syntax}
The syntax of \agfl\ will be described in the next two chapters by a
CF grammar in the notation introduced
by Van Wijngaarden \cite{WIJ72}. This notation is very similar to that of
\agfl\ itself, therefore we use different typefonts: sans serif for the
syntax of \agfl\ and courier for examples of \agfl.

Each context-free production rule consists of a \X{left-hand-side}
and a \X{right-hand-side}, separated by a colon \verb+:+.  A left
hand side consists of a \X{nonterminal}.  A right-hand-side
consists of a possibly empty series of \Xs{alternative} separated by
semicolons \verb+;+ and terminated with a period \verb+.+ .  An
\X{alternative} consists of a list of \Xs{member} separated by
commas.  A \X{member} is either a \X{nonterminal} or a
\X{terminal} enclosed in double quotes \verb+"+.

The notation admits a number of shorthand conventions, expressed by
suffixes with a general meaning. If \cmdarg{nonterminal} stands for a
sequence of letters and hyphens which is the name of a nonterminal, we
may apply the schema:
\begin{syntax}
\cmdarg{nonterminal}-list:
   \cmdarg{nonterminal};
   \cmdarg{nonterminal}, ",", \cmdarg{nonterminal}-list.
\end{syntax}
This allows us to use in our description the nonterminal
\texttt{member-list} without having to introduce an explicit rule like
\begin{syntax}
member-list:
   member;
   member, ",", member-list.
\end{syntax}

\noindent
The other shorthand conventions are
\begin{syntax}
\cmdarg{nonterminal}-sequence:
   \cmdarg{nonterminal};
   \cmdarg{nonterminal}, \cmdarg{nonterminal}-sequence.

\cmdarg{nonterminal}-series:
   \cmdarg{nonterminal};
   \cmdarg{nonterminal}, ";", \cmdarg{nonterminal}-series.

\cmdarg{nonterminal}-option:
   \cmdarg{nonterminal};  .

\cmdarg{nonterminal}-pack:
   "(", \cmdarg{nonterminal}, ")".
\end{syntax}

\noindent
Using the above notational conventions, we will describe the
\agfl-formalism in the next chapter.

\section{Type fonts}
In the sequel, examples of AGFL will be given in teletype font,
like
\begin{grammar}
RULE sentence:
   subject, verb, object.
\end{grammar}
Examples of terminal production will be given in sans serif font, like
\begin{syntax}
time flies like an arrow
\end{syntax}

\section{Related formalisms}
AGFL belongs to the family of Two-Level grammars, which includes the
following:
\begin{itemize}
\item \XXs{van Wijngaarden}{grammar}\\
The two-level Van Wijngaarden grammars (aka \XXs{W}{grammar})
were introduced by  
Aad van Wijngaarden in 1965 \cite{WIJ65} for the formal
description of {\sc algol~68}\linebreak \cite{WIJ72}. They are a ``pure" form of
two-level grammars, without any admixture of functions, a mechanism for
specification without any concessions to implementability.
An informal introduction to W-grammars can be found in \cite{CLU77}.
\item \XXs{attribute}{grammar};\\
Attribute grammars (\X{AtG}) were invented by Don Knuth, hand-in-hand with
LR(1)-parsing, in the middle sixties \cite{KNU68}.
An overview of Attribute Grammars can be found in\linebreak \cite{ALM91}.
\item \XXs{affix}{grammar}\\
Affix Grammars (\X{AG}) were invented in the early sixties by
Lambert Meertens and Kees Koster
\cite{MEK62} and used in Computer Linguistics \cite{KOS65}, as well
as in the generation of music by computer (Meertens' String Quartet
recieved a special mention by the jury at the 1968 IFIP Congress in
Edinburgh). They were later applied to programming languages and
formally described by Koster \cite{KOS71}.
\item \XXs{extended}{affix grammar}\\
Extended Affix Grammars (\X{EAG}), defined by David Watt \cite{WA71},
form a bridge between Affix Grammars and W-grammars. They have been used
in both Informatics and Computer Linguistics.
A survey of some recent research on EAG can be found in \cite{MEI90}.
An implementation of EAG can be downloaded from
{\tt ftp://ftp.cs.kun.nl/pub/eag}.
\item \XXs{metamorphosis}{grammar}\\
Defined by Colmerauer in the late sixties for linguistic purposes
\cite{COL78}, Metamorphosis Grammars have been the direct
precursor of {\sc prolog}.
\end{itemize}
A number of syntactic formalisms widely used in linguistics are closely
related to two-level grammars: various kinds of feature-based and
unification-based grammars (e.g. GPSG \cite{GPSG85}, Augmented
Transition Networks and DCG's \cite{PW80}).  The main difference
with two-level grammars is that in those formalisms the metalevel is
usually less explicitly grammatical and more like data structures
in a programming language than is the case in two-level grammars.

The Compiler Description Language \X{CDL3} \cite{KB91}, used in
implementing the \agfl\ system, is another form of
Affix Grammars, using trees over integers and texts for a second level,
but because it is intended as an (efficient) systems implementation
language it requires the underlying CF grammars to be deterministic.
The most recent implementation of CDL3 can be downloaded from
{\tt ftp://ftp.cs.kun.nl/pub/cdl3}.
