| 1 |
\documentclass[11pt,letterpaper]{book} |
| 2 |
|
| 3 |
\usepackage{times} |
| 4 |
%------------------------- |
| 5 |
% the following magic makes the tt font in math mode be the same as the |
| 6 |
% normal tt font (i.e., Courier) |
| 7 |
% |
| 8 |
\SetMathAlphabet{\mathtt}{normal}{OT1}{pcr}{n}{n} |
| 9 |
\SetMathAlphabet{\mathtt}{bold}{OT1}{pcr}{bx}{n} |
| 10 |
%------------------------- |
| 11 |
|
| 12 |
\usepackage[top=1.33in, bottom=1.33in, left=1.33in, right=1.33in]{geometry} |
| 13 |
\usepackage{amsmath} |
| 14 |
\usepackage[all]{xy} |
| 15 |
\usepackage{graphicx} |
| 16 |
\usepackage{stmaryrd} |
| 17 |
|
| 18 |
\newcommand{\ulex}{\texttt{ml-ulex}} |
| 19 |
\newcommand{\mlantlr}{\texttt{ml-antlr}} |
| 20 |
\newcommand{\antlr}{\texttt{ml-antlr}} |
| 21 |
\newcommand{\Antlr}{\texttt{Ml-antlr}} |
| 22 |
|
| 23 |
\title{ |
| 24 |
SML/NJ Language Processing Tools:\\ |
| 25 |
User Guide} |
| 26 |
\author{ |
| 27 |
Aaron Turon\\ |
| 28 |
\texttt{[email protected]}\\[0.5em] |
| 29 |
John Reppy\\ |
| 30 |
\texttt{[email protected]}} |
| 31 |
\date{Revised: April 2024} |
| 32 |
|
| 33 |
\newcommand{\Carat}{\^{ }} |
| 34 |
\newcommand{\RE}{r} |
| 35 |
\newcommand{\OR}{\ | \ } |
| 36 |
\newcommand{\AND}{\ \& \ } |
| 37 |
\newcommand{\CL}{\mathcal{L}} |
| 38 |
\newcommand{\CS}{\mathcal{S}} |
| 39 |
\newcommand{\CR}{\mathcal{R}} |
| 40 |
\newcommand{\CP}{\mathcal{P}} |
| 41 |
\newcommand{\Sem}[1]{[ \! [ #1 ] \! ]} |
| 42 |
\newcommand{\Ls}[1]{\CL\Sem{#1}} |
| 43 |
|
| 44 |
\newcommand{\eg}{{\em e.g.}} |
| 45 |
\newcommand{\cf}{{\em cf.}} |
| 46 |
\newcommand{\ie}{{\em i.e.}} |
| 47 |
|
| 48 |
\newcommand{\nm}[1]{\texttt{#1}} |
| 49 |
|
| 50 |
\newcommand{\ra}{\rightarrow} |
| 51 |
\newcommand{\Ra}{\Rightarrow} |
| 52 |
|
| 53 |
\newcommand{\New}[1]{\emph{\textbf{#1}}} |
| 54 |
|
| 55 |
% Grammar |
| 56 |
\newcommand{\Grammar}[1]{\[ \begin{array}{rcll} #1 \end{array} \]} |
| 57 |
\newcommand{\GFirst}[3]{#1 & ::= & #2 & \textrm{#3} \\ } |
| 58 |
\newcommand{\GNext}[2]{ & | & #1 & \textrm{#2} \\ } |
| 59 |
|
| 60 |
\newcommand{\GFirstB}[2]{\textit{#1} & ::= & \multicolumn{2}{l}{\textit{#2}} \\ } |
| 61 |
\newcommand{\GNextB}[1]{ & | & \multicolumn{2}{l}{\textit{#1}} \\ } |
| 62 |
|
| 63 |
\newcommand{\GFirstC}[3]{\textit{#1} & ::= & \textit{#2} & \textrm{#3} \\ } |
| 64 |
\newcommand{\GNextC}[2]{ & | & \textit{#1} & \textrm{#2} \\ } |
| 65 |
\newcommand{\GNextCC}[2]{ & | & \multicolumn{2}{l}{\textit{#1}} \\ & & & \textrm{#2} \\ } |
| 66 |
|
| 67 |
%\newcommand{\T}[1]{{\tt '#1'}} |
| 68 |
\newcommand{\T}[1]{{\textbf{\tt #1}}} |
| 69 |
\newcommand{\kw}[1]{{\T{\%#1}}} |
| 70 |
|
| 71 |
\usepackage{amsthm} |
| 72 |
|
| 73 |
\newtheorem*{theorem}{Theorem} |
| 74 |
\newtheorem*{definition}{Definition} |
| 75 |
\newtheorem*{remark}{Remark} |
| 76 |
|
| 77 |
\usepackage{ifpdf} |
| 78 |
|
| 79 |
\usepackage{mathpazo} |
| 80 |
%\renewcommand{\ttdefault}{cmtt} |
| 81 |
|
| 82 |
%\newcommand{\parttext}{} |
| 83 |
%\newcommand{\cpart}[1]{\renewcommand{\parttext}{#1}\part{#1}} |
| 84 |
|
| 85 |
\usepackage{fancyhdr} |
| 86 |
\usepackage{multicol} |
| 87 |
|
| 88 |
\newcommand{\sem}[1]{\llbracket #1\rrbracket} |
| 89 |
|
| 90 |
\usepackage{color} |
| 91 |
\definecolor{Red}{rgb}{0.9,0.0,0.0} |
| 92 |
\definecolor{DarkBlue}{rgb}{0.0,0.0,0.75} |
| 93 |
\definecolor{Purple}{rgb}{0.5,0.0,0.4} |
| 94 |
\definecolor{DarkGreen}{rgb}{0.0,0.5,0.0} |
| 95 |
\newcommand{\cdColor}{DarkBlue} |
| 96 |
\newcommand{\kwColor}{Purple} |
| 97 |
\newcommand{\dirColor}{Purple} |
| 98 |
\newcommand{\strColor}{DarkGreen} |
| 99 |
\newcommand{\comColor}{Red} |
| 100 |
|
| 101 |
\usepackage{listings} |
| 102 |
|
| 103 |
\lstdefinelanguage{SML}{% |
| 104 |
morekeywords={% |
| 105 |
abstype, and, andalso, as, case, datatype, do, else, end, eqtype, exception,% |
| 106 |
fn, fun, functor, handle, if, in, include, infix, infixr, let, local, nonfix,% |
| 107 |
of, op, open, orelse, raise, rec, sharing, sig, signature, struct, structure,% |
| 108 |
then, type, val, where, while, with, withtype% |
| 109 |
},% |
| 110 |
otherkeywords={[,],\{,\},\,,:,...,_,|,=,=>,->,\#,:>}, |
| 111 |
sensitive,% |
| 112 |
alsoletter={_}, |
| 113 |
morecomment=[n]{(*}{*)},% |
| 114 |
morestring=[d]",% |
| 115 |
}[keywords,comments,strings]% |
| 116 |
|
| 117 |
\lstdefinelanguage{CM}{% |
| 118 |
morekeywords={% |
| 119 |
functor, signature, structure,% |
| 120 |
Library, is,% |
| 121 |
},% |
| 122 |
sensitive,% |
| 123 |
alsoletter={_}, |
| 124 |
morecomment=[n]{(*}{*)},% |
| 125 |
morestring=[d]",% |
| 126 |
}[keywords,comments,strings]% |
| 127 |
|
| 128 |
\lstdefinelanguage{MLULex}[]{SML}{% |
| 129 |
moredirectives={arg,defs,header,let,name,states}, |
| 130 |
moredelim=*[directive]\%,% |
| 131 |
alsoletter={_}, |
| 132 |
}[keywords,comments,strings,directives]% |
| 133 |
|
| 134 |
\lstdefinelanguage{MLAntlr}{% |
| 135 |
morekeywords={\%defs,\%entry,\%header,\%import,\%keywords,\%name,\%nonterms,of, |
| 136 |
\%refcell,\%tokens,\%tokentype,\%start,\%value}, |
| 137 |
sensitive,% |
| 138 |
alsoletter={_,\%},% |
| 139 |
morecomment=[n]{(*}{*)},% |
| 140 |
morestring=[d]",% |
| 141 |
}[keywords,comments,strings]% |
| 142 |
|
| 143 |
\lstset{ |
| 144 |
basicstyle=\footnotesize\ttfamily\color{\cdColor}, |
| 145 |
keywordstyle=\color{\kwColor}\bfseries, |
| 146 |
commentstyle=\color{\comColor}\itshape, |
| 147 |
directivestyle=\color{\dirColor}\bfseries, |
| 148 |
stringstyle=\color{\strColor}\itshape, |
| 149 |
showstringspaces=false, |
| 150 |
language=SML |
| 151 |
} |
| 152 |
|
| 153 |
\begin{document} |
| 154 |
|
| 155 |
\frontmatter |
| 156 |
|
| 157 |
\maketitle |
| 158 |
|
| 159 |
\phantom{.} |
| 160 |
\vspace{\stretch{1}} |
| 161 |
|
| 162 |
\noindent Copyright \copyright{}2024. Fellowship of SML/NJ. All rights reserved. |
| 163 |
|
| 164 |
\vskip 12pt |
| 165 |
\noindent This document was written with support. in part, from NSF grant |
| 166 |
CNS-0454136, ``CRI: Standard ML Software Infrastructure.'' |
| 167 |
|
| 168 |
\pagebreak |
| 169 |
|
| 170 |
\tableofcontents |
| 171 |
|
| 172 |
\mainmatter |
| 173 |
|
| 174 |
% \renewcommand{\chaptermark}[1]{\markboth{#1}{}} |
| 175 |
% \renewcommand{\sectionmark}[1]{\markright{\thesection. \ #1}{}} |
| 176 |
|
| 177 |
\newpage |
| 178 |
|
| 179 |
\input{overview} |
| 180 |
|
| 181 |
% \renewcommand{\chaptermark}[1]{\markboth{\parttext{}: #1}{}} |
| 182 |
|
| 183 |
% \cpart{Usage} |
| 184 |
|
| 185 |
\input{usage-ml-ulex} |
| 186 |
\input{usage-ml-antlr} |
| 187 |
\input{ml-lpt-lib} |
| 188 |
\input{example} |
| 189 |
\input{history} |
| 190 |
|
| 191 |
% \cpart{Theory} |
| 192 |
% |
| 193 |
% \input{theory-ml-ulex} |
| 194 |
% \input{theory-ml-antlr} |
| 195 |
|
| 196 |
% \cpart{Implementation} |
| 197 |
|
| 198 |
% \input{code-ml-ulex} |
| 199 |
% \input{code-ml-antlr} |
| 200 |
|
| 201 |
%\backmatter |
| 202 |
|
| 203 |
% \bibliographystyle{plain} |
| 204 |
% \bibliography{deriv.bib} |
| 205 |
|
| 206 |
\end{document} |