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.
Docs
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:
- maya-announce
- 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)
- maya-users
- For general Maya discussions, questions
and suggestions. This is the mailing list to which all
questions should be submitted.
To subscribe send mail to majordomo@flux.cs.utah.edu
with "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 majordomo@flux.cs.utah.edu
with "unsubscribe list-name" in the body.
(We use a standard Majordomo-maintained
mailing list server.)
Sources
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
distribution.
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.
Binaries
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
mayac.
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.
Jason Baker
Last modified: Tue Jun 11 23:19:49 MDT 2002