Browse Source

use Racket graph library

Jeremy Siek 6 years ago
parent
commit
ed0ab89868
1 changed files with 43 additions and 42 deletions
  1. 43 42
      book.tex

+ 43 - 42
book.tex

@@ -187,7 +187,7 @@ adapting the structure of the Colorado course back into the land of
 Scheme. In the meantime Indiana had moved on from Scheme to Racket, so
 the course is now about compiling a subset of Racket (and Typed
 Racket) to the x86 assembly language. The compiler is implemented in
-Racket~\citep{plt-tr}.
+Racket 7.1~\citep{plt-tr}.
 
 This is the textbook for the incremental version of the compiler
 course at Indiana University (Spring 2016 - present) and it is the
@@ -2474,36 +2474,37 @@ Figure~\ref{fig:interfere}.
 \label{fig:interfere}
 \end{figure}
 
-Our next concern is to choose a data structure for representing the
-interference graph. There are many choices for how to represent a
-graph, for example, \emph{adjacency matrix}, \emph{adjacency list},
-and \emph{edge set}~\citep{Cormen:2001uq}. The right way to choose a
-data structure is to study the algorithm that uses the data structure,
-determine what operations need to be performed, and then choose the
-data structure that provide the most efficient implementations of
-those operations. Often times the choice of data structure can have an
-effect on the time complexity of the algorithm, as it does here. If
-you skim the next section, you will see that the register allocation
-algorithm needs to ask the graph for all of its vertices and, given a
-vertex, it needs to known all of the adjacent vertices. Thus, the
-correct choice of graph representation is that of an adjacency
-list. There are helper functions in \code{utilities.rkt} for
-representing graphs using the adjacency list representation:
-\code{make-graph}, \code{add-edge}, and \code{adjacent}
-(Appendix~\ref{appendix:utilities}).
-%
-\margincomment{\footnotesize To do: change to use the
-    Racket graph library. \\ --Jeremy}
-%
-In particular, those functions use a hash table to map each vertex to
-the set of adjacent vertices, and the sets are represented using
-Racket's \key{set}, which is also a hash table.
+%% Our next concern is to choose a data structure for representing the
+%% interference graph. There are many choices for how to represent a
+%% graph, for example, \emph{adjacency matrix}, \emph{adjacency list},
+%% and \emph{edge set}~\citep{Cormen:2001uq}. The right way to choose a
+%% data structure is to study the algorithm that uses the data structure,
+%% determine what operations need to be performed, and then choose the
+%% data structure that provide the most efficient implementations of
+%% those operations. Often times the choice of data structure can have an
+%% effect on the time complexity of the algorithm, as it does here. If
+%% you skim the next section, you will see that the register allocation
+%% algorithm needs to ask the graph for all of its vertices and, given a
+%% vertex, it needs to known all of the adjacent vertices. Thus, the
+%% correct choice of graph representation is that of an adjacency
+%% list. There are helper functions in \code{utilities.rkt} for
+%% representing graphs using the adjacency list representation:
+%% \code{make-graph}, \code{add-edge}, and \code{adjacent}
+%% (Appendix~\ref{appendix:utilities}).
+%% %
+%% \margincomment{\footnotesize To do: change to use the
+%%     Racket graph library. \\ --Jeremy}
+%% %
+%% In particular, those functions use a hash table to map each vertex to
+%% the set of adjacent vertices, and the sets are represented using
+%% Racket's \key{set}, which is also a hash table.
 
 \begin{exercise}\normalfont
 Implement the compiler pass named \code{build-interference} according
-to the algorithm suggested above.  The output of this pass should be
-stored in the $\itm{info}$ field of the program, under the key
-\code{conflicts}.
+to the algorithm suggested above. We recommend using the Racket
+\code{graph} library to create and inspect the interference graph.
+The output graph of this pass should be stored in the $\itm{info}$
+field of the program, under the key \code{conflicts}.
 \end{exercise}
 
 \section{Graph Coloring via Sudoku}
@@ -7106,24 +7107,24 @@ The association list may contain both immutable pairs (built with
 The \key{map2} function ...
 
 
-\subsection{Graphs}
+%% \subsection{Graphs}
 
-\begin{itemize}
-\item The \code{make-graph} function takes a list of vertices
-  (symbols) and returns a graph.
+%% \begin{itemize}
+%% \item The \code{make-graph} function takes a list of vertices
+%%   (symbols) and returns a graph.
 
-\item The \code{add-edge} function takes a graph and two vertices and
-  adds an edge to the graph that connects the two vertices. The graph
-  is updated in-place. There is no return value for this function.
+%% \item The \code{add-edge} function takes a graph and two vertices and
+%%   adds an edge to the graph that connects the two vertices. The graph
+%%   is updated in-place. There is no return value for this function.
 
-\item The \code{adjacent} function takes a graph and a vertex and
-  returns the set of vertices that are adjacent to the given
-  vertex. The return value is a Racket \code{hash-set} so it can be
-  used with functions from the \code{racket/set} module.
+%% \item The \code{adjacent} function takes a graph and a vertex and
+%%   returns the set of vertices that are adjacent to the given
+%%   vertex. The return value is a Racket \code{hash-set} so it can be
+%%   used with functions from the \code{racket/set} module.
 
-\item The \code{vertices} function takes a graph and returns the list
-  of vertices in the graph.
-\end{itemize}
+%% \item The \code{vertices} function takes a graph and returns the list
+%%   of vertices in the graph.
+%% \end{itemize}
 
 \subsection{Testing}