Duncan C. White, email@example.com
14th August 2014
Datadec takes inductive data types modelled on those found in functional languages (Hope, Miranda, Haskell etc) and generates ANSI C code to implement them.
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.
See the INSTALL file for building and packaging instructions. Hope you enjoy datadec.
Name Last modified Size DescriptionApache Server at csgsoft.doc.ic.ac.uk Port 80
Parent Directory - INSTALL 2014-11-26 20:30 1.1K datadec-1.2.tgz 2014-11-27 20:52 22K README.html 2016-01-29 15:24 2.2K