%!TEX root = manual.tex
%

\usepackage{times}
%-------------------------
% the following magic makes the tt font in math mode be the same as the
% normal tt font (i.e., Courier)
%
\SetMathAlphabet{\mathtt}{normal}{OT1}{pcr}{n}{n}
\SetMathAlphabet{\mathtt}{bold}{OT1}{pcr}{bx}{n}
%-------------------------

\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{hyperref}

\newcommand{\eg}{{\em e.g.}}
\newcommand{\cf}{{\em cf.}}
\newcommand{\ie}{{\em i.e.}}
\newcommand{\etc}{{\em etc.\/}}
\newcommand{\naive}{na\"{\i}ve}
\newcommand{\Naive}{Na\"{\i}ve}
\newcommand{\ala}{{\em \`{a} la\/}}
\newcommand{\etal}{{\em et al.\/}}
\newcommand{\role}{r\^{o}le}
\newcommand{\vs}{{\em vs.}}
\newcommand{\forte}{{fort\'{e}\/}}

\newcommand{\asdl}{\textsc{ASDL}}
\newcommand{\asdlgen}{\texttt{asdlgen}}

\newcommand{\Cplusplus}{\mbox{C\hspace{-.05em}\raisebox{.4ex}{\small\bf ++}}}
\newcommand{\java}{\textsc{Java}}
\newcommand{\sml}{\textsc{SML}}
\newcommand{\cm}{\textsc{CM}}
\newcommand{\smlnj}{\textsc{SML/NJ}}
\newcommand{\ocaml}{\textsc{OCaml}}
\newcommand{\haskell}{\textsc{Haskell}}
\newcommand{\mlb}{\textsc{MLB}}

\newcommand{\chapref}[1]{\hyperref[#1]{Chapter~\ref{#1}}}
\newcommand{\secref}[1]{\hyperref[#1]{Section~\ref{#1}}}
\newcommand{\figref}[1]{\hyperref[#1]{Figure~\ref{#1}}}
\newcommand{\tblref}[1]{\hyperref[#1]{Table~\ref{#1}}}

\usepackage{color}
\definecolor{Red}{rgb}{0.9,0.0,0.0}
\definecolor{DarkBlue}{rgb}{0.0,0.0,0.75}
\definecolor{Purple}{rgb}{0.5,0.0,0.4}
\definecolor{DarkGreen}{rgb}{0.0,0.5,0.0}
\newcommand{\cdColor}{DarkBlue}
\newcommand{\kwColor}{Purple}
\newcommand{\dirColor}{Purple}
\newcommand{\strColor}{DarkGreen}
\newcommand{\comColor}{Red}

\usepackage{listings}

\lstdefinelanguage{SML}{%
  morekeywords={%
    abstype, and, andalso, as, case, datatype, do, else, end, eqtype, exception,%
    fn, fun, functor, handle, if, in, include, infix, infixr, let, local, nonfix,%
    of, op, open, orelse, raise, rec, sharing, sig, signature, struct, structure,%
    then, type, val, where, while, with, withtype%
  },%
  otherkeywords={[,],\{,\},\,,:,...,_,|,=,=>,->,\#,:>},
  sensitive,%
  alsoletter={_},
  morecomment=[n]{(*}{*)},%
  morestring=[d]",%
}[keywords,comments,strings]%

\lstdefinelanguage{ASDL}{%
  morekeywords={alias,attributes,import,include,module,primitive,view},%
  otherkeywords={:,=,\{,\},\,,<=,\%\%,?,*,!,|},
  sensitive,%
  alsoletter={_},
  morecomment=[l]{--},%
}[keywords,comments]%

\lstset{
  basicstyle=\small\ttfamily\color{\cdColor},
  keywordstyle=\color{\kwColor}\bfseries,
  commentstyle=\color{\comColor}\itshape,
  showstringspaces=false,
  language=ASDL
}

% indented code displays
%
%\newenvironment{code}{\begin{quote}}{\end{quote}}
\newenvironment{code}%
  {\list{}{\leftmargin=\parindent}\item[]}%
  {\endlist}


\newcommand{\cd}[1]{\texttt{\color{\cdColor}#1}}
\newcommand{\kw}[1]{\texttt{\bfseries\color{\kwColor}#1}}

% for typesetting the syntax
%
\usepackage{syntax}
\makeatletter
\renewcommand{\ulitleft}{\normalfont\ttfamily\color{\kwColor}\bfseries\syn@ttspace\frenchspacing}
\makeatother
\renewcommand{\ulitright}{}
\renewcommand{\grammarlabel}[2]{%
  \synt{#1}\;\;#2\;}
\setlength{\grammarindent}{8em}

