About this set of interpreters This is a set of interpreters for a family of language that bear some resemblance to both ML and Scheme. The interpreters are written in ocaml, the version of ML developed at the INRIA (France) and available at ftp://ftp.inria.fr/INRIA/caml-light/ Since the interpreters are all greatly similar, they are organized as a CVS tree, with each interpreter sitting at the tip of one branch. To obtain an initial checkout of the basic interpreter, extract the distributed tarball in a directory called cvsroot/ (we will write this simply as cvsroot/ but you must specify a complete path at all times) so that the RCV files (having extension ,v) extract in cvsroot/interp/ and then move to another directory (say, work/) and type cvs -d cvsroot/ checkout interp this will create a directory called work/interp/ that contains the basic interpreter. You can then move back and forth between interpreters. To move to the lazy interpreter, for example, try cvs update -r lazy (to be run from the work/interp/ directory). To move back to the basic interpreter, type cvs update -A You can also perform diffs. For example, cvs diff -r lazy -u will compare the currently checked out interpreter with the lazy interpreter. To obtain a list of available interpreters, type cvs status -v README and look for the existing branch tags. (Of course, we cannot include the list in question in this file because this file is part of the CVS tree.) To compile an interpreter, use the accompanying Makefile. Simply typing make (or gmake, that is GNU make) should work. This requires ocamlc and its companion utilities (ocamllex, ocamlyacc). Since ocaml is completely portable, there are no OS-dependent options or parameters to be set. There is also a test suite. To run it, just type make check or go in the testsuite/ directory and run the runtests.sh shell script. The test programs are the test*.prg and the predicted outputs are the test*.vfy files. The test files are also samples of the interpreter language. About this language The RCS identification (of this README file) string that uniquely characterizes the language you have currently checked out is: $Id: README,v 1.2 1999/07/20 12:47:45 david Exp $ This is the basic language interpreter, from which all others are derived, and to which all others are compared. To summarize, the language is a weakly dynamically typed, lexically scoped, eager evaluating (``call-by-value''), functional programming language, with a single namespace, in which functions have first-class citizenship. All data are immutable. The available types are Unit (no-content), Boolean (@t for true and @f for false), integer, character string and function. All functions take exactly one argument. Functional application is denoted by plain juxtaposition, that is, f x means f applied to x. Functional abstraction (the ``lambda'' operation) is denoted by a highly stylized arrow: so x>x is the identity function (taking x to x), and f>x>f x is the function taking f and x (in a curried fashion) to the value of f at x (i.e. the application function). (Note that application has precedence over functional abstraction; the former associates to the left whereas the latter associates to the right. Parentheses can be used to force a different precedence or associativity. So f>g>h>f h(g h) is also f>(g>(h>((f h)(g h)))).) A semicolon is used to evaluate two expressions successively, and ignore the first. For example, print "Foo\n" ; print "Bar\n" will print ``Foo'' and then ``Bar'' on two different lines. (The semicolon has higher precedence than functional abstraction, but lower than application.) The test primitive is written if?then:else as in C: the if part is evaluated, and if its value is other than @f then the then part is evaluated, otherwise the else part is evaluated. (The precedence of the ?: ternary operation is higher than abstraction and lower than application, but its relation to the semicolon is left unspecified, so always use parentheses.) Whitespace is free form. Comments start with a sharp sign and extend to the end of the line. Character strings are surrounded by double quotes, and the backslash sequences \\, \n, \r, \t, \b and \" have the usual meaning. The only defined primitive functions are ``print'' (which prints a character string or integer), ``add'', ``sub'' and ``mul'' (which perform the corresponding integer operations) and ``eq'' (which tests for integer equality).