Macros That Play:
Migrating From Java to Maya
Maya is a version of Java that allows users to write their own
syntax extensions, which are called Mayans. Mayans can
reinterpret or extend Maya syntax by expanding it to other Maya
syntax: they operate on abstract syntax trees, and their expansion
is triggered during parsing as semantic actions. Maya's
expressiveness comes from treating grammar productions as generic
functions, and Mayans as multi-methods on those generic functions.
Mayans are defined using a rich set of parameter specializers:
Mayans can be dispatched on type of an AST node, the static type
of an expression, the value of a token, or the substructure of any
AST node. Multiple dispatch allows users to extend the semantics
of the language by overriding the language's base actions.
My Master's thesis describes Maya.
Unfortunately, the thesis is already out of date. A more readable
overview of Maya is available here. The latest release notes and notes on Windows may also be helpful. For up to the
minute information, subscribe to the Maya mailing lists:
- For announcements related to Maya. This
is a very low-volume mailing list which will only contain
announcements from us about new Maya releases. (Note that
maya-users is included on this list, so you don't need to
subscribe to both)
- For general Maya discussions, questions
and suggestions. This is the mailing list to which all
questions should be submitted.
To subscribe send mail to email@example.com
"subscribe list-name" in the body.
For example, "subscribe maya-users" will add your email
address to the maya-users list. To unsubscribe send mail to firstname.lastname@example.org
"unsubscribe list-name" in the body.
(We use a standard Majordomo-maintained
mailing list server.)
Maya is available in source form through three tar files:
Fat kawa is a modified version of
Per Bothner's Kawa
Scheme compiler. Maya must be compiled and run against the
version of kawa provided here, rather than the mainline
Each tar file depends on the previous ones. The Maya distribution
includes implementations of the MultiJava and Handi-Wrap
Languages, as well as the Handi-Wrap retrofitter. To compile or
run the retrofitter, you will need a copy of The Bytecode Engineering
Library. Version 4.4.0 is available here in source and binary forms.
The Maya distribution also includes a number of helpful macros
such as foreachand comprehension
syntax for declaring arrays and collections (similar to list
comprehensions in Haskel).
In accordance with the GPL other
sources are available here as well.
Maya generates parse tables with a JNI library containing Bison code. We
precompiled binaries for:
The UNIX binary distributions are built to be installed in
/usr/local. To install in a different location, change
the line prefix=/usr/local near the beginning of
The Windows distribution requires Cygwin's
/bin/sh and along with related commands such as
tr and sed. Again, edit prefix and
classdir to suit your taste.
Last modified: Tue Jun 11 23:19:49 MDT 2002