%% Beginning of what Boon copied from Jamey

%\input{psadobe}  % illustrations inputs this already.

%\def\illustrationfileprefix{/home/df/id-world/docs/id-compiler/001/}
\def\illustrationfileprefix{./}
\def\illustration#1{{\centering {\psadobe {\illustrationfileprefix#1.ps}}}}


% short forms for ``i.e.'', ``e.g.'', ``etc.''
\newcommand{\ie}{{\em i.e.,\/}}
\newcommand{\eg}{{\em e.g.,\/}}
\newcommand{\etc}{{\em etc.\/}}

\newcommand{\term}[1]{{\tt #1}}
\newcommand{\bslash}{\mbox{\tt $\backslash$}}

\title{PAGEN --- PArser GENerator for Common Lisp}
\author{Program: Ken Traub, Documentation: Jamey Hicks}

% Allow @ in control sequence names  
\makeatletter



%%% Environments:

%%% The example environment.   This is similar to verbatim, but only treats end
%%% of line and space as verbatim; control sequences, braces, and such work as
%%% before.  One situation in which this is useful is when you want to include
%%% italic text.  Unfortunately, if you include {\it stuff} the space between
%%% \it and stuff is typeset, since spaces are treated verbatim.  One way to
%%% avoid this is to type {\it{}stuff}.  A better way is to say \i{stuff}; \i
%%% is defined within example for just this purpose.

%%% We reuse as much LaTeX code as possible -- in a sneaky way by making
%%% \dospecials be a no-op, thus preventing the deactivation of the special
%%% characters.  Because special characters still work, we don't need the
%%% hackery needed by \endverbatim.
%%% Adjacent lines of an example environment get \examplepenalty inserted
%%% between them.  Beginning a line with \hinge removes the immediately
%%% preceding penalty.  Thus, setting \examplepenalty to 10000 prevents
%%% line breaks except between lines separated by \hinge.
\newcount\examplepenalty
\examplepenalty=0
\def\example{%
  \def\{{\relax\char`\{}%
  \def\}{\relax\char`\}}%
  \let\temp=\dospecials\let\dospecials=\relax
  \let\@@@par=\@@par
  \def\@@par{\@@@par\penalty\examplepenalty}%
  \@verbatim
  \def\hinge{\penalty0\relax}%
  \let\dospecials=\temp
  \def\i##1{{\it ##1}}%
  \def\t##1{{\tt ##1}}%
  \def\b##1{{\bf ##1}}%
  \frenchspacing\@vobeyspaces}
\def\endexample{\penalty0\endtrivlist}

%%% Environment vtrivlist are designed to provide the same vertical spacing
%%% of trivlist, but instead of having items in its body should just contain
%%% vertical mode material.  Quite often the vertical mode material is just an
%%% alignment.
\def\vtrivlist{%
  \@topsep\topsep
  \advance\@topsep\partopsep
  \advance\@topsep\parskip
  \vskip\@topsep}
\def\endvtrivlist{%
  \@topsep\topsep
  \advance\@topsep\partopsep
  \vskip\@topsep}

% Restore @ to "other" status.
\makeatother

%%% Defines environment: BNF style definitions
%%% Control sequences:
%%%   \is             - Separates LHS from RHS.
%%%   \Or             - Separates alternatives.
%%%   \OR             - Separates alternatives and continues on next line.
%%%   \NEWLINE        - Continues entry on next line.
%%%   \\              - Terminates an entry.
%%%   \arbno{foo}     - Zero or more occurences of nonterm `foo'.
%%%   \ntimes{n}{foo} - N occurences of nonterm `foo'.
%%%   \term{foo}      - Terminal symbol `foo'.
%%%   \nterm{foo}{n}  - Terminal symbol `foo', whose value is called `n'.
%%%   \tok{foo}       - Token named `foo'.
%%%   \Long           - Precedes line with unusually long LHS; this LHS won't
%%%                     affect the alignment of other entries.
%%% Example:
%%%   \begin{defines}
%%%     contents \is dm-contents \Or im-contents \\
%%%     module \is \arbno{record}\\
%%%     \Long define-broadcast-area-record \is \tok{define-area} name mtype
%%%       pe pe pe \NEWLINE address address address bool \\
%%%   \end{defines}
\newcommand{\equals}{$=$}
\def\defines{%
  \def\par{}%                                   % Allows gratuitous blank lines.
  \def\\{\cr\noalign{\penalty5000}}%
  \def\blankline{\noalign{\penalty0\vskip\baselineskip}}%
  \def\is{&$\rightarrow$&}%
  \def\equals{&$=$&}
  \def\Or{{$|$} }%
  \def\OR{\Or\NEWLINE}%
  \def\NEWLINE{\cr\noalign{\penalty10000}&&}%
  \def\arbno##1{$\lbrace\hbox{##1}\rbrace^*$}%
  \def\ntimes##1##2{$\lbrace\hbox{##2}\rbrace^{##1}$}%
  \def\nterm##1##2{$\hbox{\tt ##1}(##2)$}%      % Named terminal
  \def\term##1{{\tt ##1}}%
  \def\tok##1{{\tt <##1>}}%
  %% \spaceskip=0.5em in \Long and in the template so that there's more space
  %% between things on the RHS.
  \def\Long{\multispan3\sc
            \def\is{\unskip\quad$\rightarrow$\quad\spaceskip=0.5em\relax}%
            \def\\{\hfil\cr\noalign{\penalty5000}}%
            \def\NEWLINE{\hfil\cr\noalign{\penalty10000}&&}}%
  \begin{vtrivlist}
    \halign\bgroup
      \sc##\hfil&\quad\hfil##\hfil\quad&\sc\spaceskip=0.5em\relax##\hfil\cr}
\def\enddefines{%
      \crcr
      \noalign{\penalty0}%
    \egroup
  \end{vtrivlist}}

%%% end of what Boon copied  from Jamey.

