|
ABSTRACT
We have designed and implemented Maya, a version of Java that allows programmers to extend and reinterpret its syntax. Maya generalizes macro systems by treating grammar productions as generic functions, and semantic actions on productions as multimethods on the corresponding generic functions. Programmers can write new generic functions (i.e., grammar productions) and new multimethods (i.e., semantic actions), through which they can extend the grammar of the language and change the semantics of its syntactic constructs, respectively. Maya's multimethods are compile-time metaprograms that transform abstract syntax: they execute at program compile-time, because they are semantic actions executed by the parser. Maya's multimethods can be dispatched on the syntactic structure of the input, as well as the static, source-level types of expressions in the input. In this paper we describe what Maya can do and how it works. We describe how its novel parsing techniques work and how Maya can statically detect certain kinds of errors, such as code that generates references to free variables. Finally, to demonstrate Maya's expressiveness, we describe how Maya can be used to implement the MultiJava language, which was described by Clifton et al. at OOPSLA 2000.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
Alfred V. Aho , Ravi Sethi , Jeffrey D. Ullman, Compilers: principles, techniques, and tools, Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 1986
|
 |
2
|
Jonthan Bachrach , Keith Playford, The Java syntactic extender (JSE), Proceedings of the 16th ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications, p.31-42, October 14-18, 2001, Tampa Bay, FL, USA
|
| |
3
|
J. Baker. Macros that play: Migrating from Java to Maya. Master's thesis, University of Utah, Dec. 2001. http://www.cs.utah.edu/~jbaker/maya/thesis.html
|
 |
4
|
|
| |
5
|
|
 |
6
|
|
 |
7
|
|
| |
8
|
L. Cardelli, F. Matthes, and M. Abadi. Extensible syntax with lexical scoping. Technical Report 121, DEC SRC, Feb. 1994
|
| |
9
|
C. Chambers. The Cecil Language Specification and Rationale: Version 2.0, 1995
|
 |
10
|
Shigeru Chiba, A metaobject protocol for C++, Proceedings of the tenth annual conference on Object-oriented programming systems, languages, and applications, p.285-299, October 15-19, 1995, Austin, Texas, United States
|
| |
11
|
C. Clifton. The MultiJava project. http://www.cs.iastate.edu/~cclifton/multijava/index.shtml
|
 |
12
|
Curtis Clifton , Gary T. Leavens , Craig Chambers , Todd Millstein, MultiJava: modular open classes and symmetric multiple dispatch for Java, Proceedings of the 15th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, p.130-145, October 2000, Minneapolis, Minnesota, United States
|
 |
13
|
|
| |
14
|
D. de Rauglaudre. Camlp4 reference manual. http://caml.inria.fr/camlp4/manual/, Jan. 2002
|
| |
15
|
W. Divoky, C. Forgione, T. Graf, C. Laborde, A. Lemonnier, and E. Wais. The Kopi project. http://www.dms.at/kopi/index.html
|
 |
16
|
R. Ducournau , M. Habib , M. Huchard , M. L. Mugnier, Monotonic conflict resolution mechanisms for inheritance, conference proceedings on Object-oriented programming systems, languages, and applications, p.16-24, October 18-22, 1992, Vancouver, British Columbia, Canada
|
| |
17
|
|
| |
18
|
|
| |
19
|
|
 |
20
|
Steven E. Ganz , Amr Sabry , Walid Taha, Macros as multi-stage computations: type-safe, generative, binding macros in MacroML, Proceedings of the sixth ACM SIGPLAN international conference on Functional programming, September 03-05, 2001, Florence, Italy
|
| |
21
|
R. Kelsey, W. Clinger, and J. Rees (Eds.). The revised report on the algorithmic language Scheme. ACM SIGPLAN Notices, 33(9), Sept. 1998
|
| |
22
|
|
| |
23
|
|
| |
24
|
W. Maddox. Semantically-sensitive macroprocessing. Master's thesis, University of California, Berkeley, 1989
|
| |
25
|
Microsoft. C# language specification. http://msdn.microsoft.com/library/dotnet/csspec/vclrfcsharpspec_Start.htm
|
 |
26
|
|
| |
27
|
A. Shalit. Dylan Reference Manual. Addison-Wesley, 1996
|
| |
28
|
|
| |
29
|
M. Tatsubori, S. Chiba, M. Killijian, and K. Itano. OpenJava: A class-based macro system for Java. In Proceedings of the OOPSLA '00 Reflection and Software Engineering Workshop, Minneapolis, MN, Oct. 2000
|
 |
30
|
|
| |
31
|
Xerox. The AspectJ programming guide. http://www.aspectj.org/doc/dist/progguide/
|
CITED BY 17
|
|
|
|
|
|
|
|
Macneil Shonle , Karl Lieberherr , Ankit Shah, XAspects: an extensible system for domain-specific aspect languages, Companion of the 18th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, October 26-30, 2003, Anaheim, CA, USA
|
|
|
|
|
|
|
|
|
|
|
|
Eric Van Wyk , Lijesh Krishnan , Derek Bodin , Eric Johnson, Adding domain-specific and general purpose language features to Java with the Java language extender, Companion to the 21st ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications, October 22-26, 2006, Portland, Oregon, USA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Shuangbao Wang , Zegang Dong , Jim X. Chen , Robert S. Ledley, PPL: A whole-image processing language, Computer Languages, Systems and Structures, v.34 n.1, p.18-24, April, 2008
|
|
|
|
|
|
|
|
|
|
|
|
Vladimir Oliveira Di Iorio , Leonardo Vieira dos Santos Reis , Roberto da Silva Bigonha , Mariza Andrade da Silva Bigonha, A proposal for extensible AspectJ, Proceedings of the 4th workshop on Domain-specific aspect languages, March 03-03, 2009, Charlottesville, Virginia, USA
|
|