Skip to content

Student-facing code from the book *Programming Languages: Build, Prove, and Compare* by Norman Ramsey

Notifications You must be signed in to change notification settings

nrnrnr/build-prove-compare-student-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This directory contains source code for students to use with the
book *Programming Languages: Build, Prove, and Compare*.
This distribution does *not* include solutions to many exercises
(garbage collection, type checking, unification, etc), so the
interpreters are incomplete.  Binary code for complete interpreters
should be available from your instructor.

The interpreters, which are written in C and in ML, are available in
two flavors.

  * The `bare' flavor is bare, uncommented code extracted from the
    book.  Code chunks are marked with their name and page numbers
    using comments in the code.  

  * The `commented' flavor is the same code, also extracted from the
    book, but with comments taken from the book.  These comments are
    extracted automatically, so the results aren't always what you
    would hope for, but some people may find them useful.  

Both flavors of code have been forced to fit into 80 columns using
automated techniques, which sometimes split lines that are not split
in the book.  Some lines of code, particularly in the garbage
collector, contain a comment like /* OMIT */.  This comment marks code
that would be distracting to include in the book text but which may be
useful for doing some of the problems.

Each of the two flavors appears in a directory of the same name, and
each of these directories contains one subdirectory per interpreter.

  impcore       Impcore (Chapter 1)
  nml           nano-ML (Chapter 7)
  timpcore      Typed Impcore (Chapter 6)
  tuscheme      Typed uScheme (Chapter 6)
  uml           uML (Chapter 8)
  umlx          uML extended with existential types (Appendix C)
  uprolog       uProlog (Appendix D)
  uscheme       uScheme implemented in C (Chapter 2)
  uscheme-copy  uScheme with support for copying collection (Chapter 4)
  uscheme-ms    uScheme with support for mark/sweep collection (Chapter 4)
  uscheme-ml    uScheme implemented in ML (Chapter 5)
  uschemeplus   uScheme+ implemented in C (Chapter 3)
  usmalltalk    uSmalltalk (Chapter 10)

Each interpreter comes with a Makefile that does something.
Regrettably, there is no Makefile that works with all gcc versions,
but the distributed Makefiles should work with gcc 10 and 11.
If you have gcc 12 or later, or if your C compiler balks for
any reason, you can change the flags passed to the C compiler
by editing the `config.mk` file in this directory.

In some cases the Makefile may be specialized to the environment at
Tufts and so may be less than useful to you.  At Tufts we compile the
interpreters using gcc, Moscow ML, and mlton.  For uscheme-copy and
uscheme-ms, you may want to compile with the option -DNOVALGRIND, or
with a -I option that gets valgrind.  At Tufts you get valgrind by
running

   make CPPFLAGS="-I. -I/usr/sup/include"


There are some additional subdirectories:

  impcore-with-locals    Impcore with a parser modified for local variables
                         (bare directory only).
  tuscheme-with-capture  Typed uScheme with substitution implemented wrongly
  uhaskell               A prototype uHaskell that didn't make it into the book


The top-level directories are organized as follows:

  bare          Bare interpreters
  commented     Commented interpreters
  examples      A few example programs extracted from the text
  transcripts   Transcripts from some chapters.  These may be useful
                for cutting and pasting code for some exercises.

About

Student-facing code from the book *Programming Languages: Build, Prove, and Compare* by Norman Ramsey

Resources

Stars

Watchers

Forks

Packages

No packages published