diff --git a/README b/README index 1231c4e51aa5ce19163a3425fc7dee39fe0a4d44..9c756726d9ccd9c9c87291287baef6c641839374 100644 --- a/README +++ b/README @@ -5,54 +5,48 @@ implement them. Duncan C. White, dcw@doc.ic.ac.uk 19th March 2002 -Building and Packaging on Linux +An Example of Datadec in Action ------------------------------- -Either download http://csgsoft.doc.ic.ac.uk/datadec/datadec-1.0-1.i386.rpm -and install it (rpm -i) from there, or do a source build: - -1. Download the datadec-1.0.tgz file and save it in your RPM SOURCES directory. - -2. Extract the package SPEC file: - - tar xzf datadec-1.0.tgz datadec-1.0/PKG/RPM - -3. Enter the directory and build the package: - - cd datadec-1.0/PKG/RPM - rpm -bb datadec.spec - -4. Now you can install the datadec-1.0-1.is386.rpm that you just built, - using rpm -i.. - - -Building on Solaris or Other Unices ------------------------------------ - -1. Extract the .tgz file.. - -2. Compile it: - - cd datadec-1.0 - make - -3. Install it (run this as root) into /usr/local/bin and /usr/man/man1: - - make install - -4. (Optionally on Solaris) package it up and store in somewhere: - - cd PKG/Solaris - make - - (edit Makefile, changing where to store the built package) - - make install - -5. install the package (as root): - - pkgadd -d datadec-1.0-1-sol8-sparc-dcw all - +To give you a feel for what datadec can do, you could write: + +intlist = nil + | cons( int first, intlist next ) + ; + +illist = nil + | cons( intlist first, illist next ) + ; + +idtree = leaf( string id, illist l ) + | node( idtree left, idtree right ) + ; + + +What does this mean? +The first rule declares that an intlist can take two basic "shapes" - +it is either empty, nil, or of the form cons(int,intlist). +nil and cons() are called constructors, and define different +"shapes" that objects of the type can take. +However, because the second argument of a cons() constructor is itself +an intlist, this type is said to be recursively defined. +Functional programmers will recognise nil or cons() as the standard +way of defining a list, so more intuitively, intlist is simply +a list of integers! + +Reading on, an illist is declared as a list of intlists, +and an idtree is declared as a binary tree where each leaf node +contains a (string, illist) pair. + +Given this input, datadec can automatically construct an ANSI C +module which implements all the data types, a constructor function for +each constructor, deconstructor functions to help you to take objects +apart again and printing functions to help you with debugging. + +Building and Packaging datadec +------------------------------ + +See the INSTALL file for building and packaging instructions. Testing -------