Go back to the main project page
SLAT (Simple Language for Abstract Types) uses LISP-like declarations of abstract syntax to define programs. It looks a lot like BNF and has basically the same functionality as Scheme's define-datatype.
As an introduction to abstract type declarations, here are some examples of SLAT declarations for a tree and a list:
tree ::= leaf ( int )
| node ( String tree tree )
int-list ::= null ()
| cons ( int int-list )
The first declares a tree as either a leaf with an integer field or as a node with a string field and two tree fields. The second declares an int-list as either null (no fields) or as a cons with an integer and int-list field.
SLAT declarations (like define-datatype) can have any number of variants. For example, the lambda calculus looks like this in SLAT:
exp ::= var-exp ( String )
| lambda-exp ( String exp )
| app-exp ( exp exp )