\documentclass[12pt]{article}

\usepackage{times,mathptm}
\pagestyle{myheadings}



\parindent 0in
\setlength{\parindent}{0in}
\setlength{\parskip}{1ex}

\topmargin -0.1in \headheight\baselineskip
\textheight 8.5in         % 1in top and bottom margin
\textwidth 6.5in        % 1in left and right margin
\oddsidemargin 0in
\evensidemargin 0in




%\usepackage{amsmath}
%\usepackage{amssymb}


% \setlength{\itemsep}{0pt}

\markright{\footnotesize CS 451 Programming Paradigms, Spring 2001}

\begin{document}

\section*{Homework set 14: Simple programs in ML --- due Wednesday 21 March}

Total number of points available on this homework is 100. Full credit
is equivalent to 100 points.


\begin{enumerate}

\item   (40 pts.)
Represent Scheme S-expressions as follows: for Scheme atoms, use
\begin{quote}
$\textbf{datatype} \ \textit{Atom} = 
\textit{Nil} \mid \textit{Num} \ \textbf{of} \ \textit{int} \mid \textit{Id} \ \textbf{of} \ \textit{string}$
\end{quote}
For the lists themselves, use:
\begin{quote}
$\textbf{datatype} \ \alpha \ \textit{Sexp} = 
\textit{Leaf} \ \textbf{of} \ \alpha \mid 
\textit{ConsNode} \ \textbf{of} \ \alpha \ \textit{Sexp} * \alpha \ \textit{Sexp}$
\end{quote}

Write a function \textit{sexpprint} to convert an S-expression into a 
character string
in the usual Scheme output format.


\item (60 pts.)
Continuing the preceding exercise, write a function \textit{sexpparse} to 
parse a character string containing the text of an S-expression. For any
valid expression $e$ of type \textit{Atom Sexp}, it should be the case that
$e = \textit{sexpparse} (\textit{sexpprint} \ e)$.


\end{enumerate}


\end{document}

