Abstract
Polyglot is an extensible compiler framework that supports the easy creation of compilers for languages similar to Java, while avoiding code duplication. The Polyglot framework is useful for domain-specific languages, exploration of language design, and for simplified versions of Java for pedagogical use. We have used Polyglot to implement several major and minor modifications to Java; the cost of implementing language extensions scales well with the degree to which the language differs from Java. This paper focuses on the design choices in Polyglot that are important for making the framework usable and highly extensible. Polyglot source code is available.
This research was supported in part by DARPA Contract F30602-99-1-0533, monitored by USAF Rome Laboratory, in part by ONR Grant N00014-01-1-0968, and in part by NSF awards 0133302 and 0208642. The views herein should not be interpreted as representing the policies or endorsement of NSF, DARPA or AFRL.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Martin Alt, Uwe Aβmann, and Hans van Someren. Cosy compiler phase embedding with the CoSy compiler model. In Peter A. Fritzson, editor, Proceedings of the 5th International Compiler Construction Conference (CC’94), volume 786 of Lecture Notes in Computer Science, pages 278–293, Edinburgh, UK, April 1994.
Jason Baker and Wilson C. Hsieh. Maya: Multiple-dispatch syntax extension in Java. In Proc. of theACMSIGPLAN’ 02 Conference on Programming Language Design and Implementation (PLDI), pages 270–281, Berlin, Germany, June 2002.
Don Batory, Bernie Lofaso, and Yannis Smaragdakis. JTS: tools for implementing domainspecific languages. In Proceedings Fifth International Conference on Software Reuse, pages 143–53, Victoria, BC, Canada, 1998. IEEE.
Gilad Bracha. The Programming Language Jigsaw: Mixins, Modularity and Multiple Inheritance. PhD thesis, University of Utah, 1992.
Craig Chambers. Object-oriented multi-methods in Cecil. In Ole Lehrmann Madsen, editor, Proceedings of the 6th European Conference on Object-Oriented Programming (ECOOP), volume 615, pages 33–56, Berlin, Heidelberg, NewYork, Tokyo, 1992. Springer-Verlag.
Curtis Clifton, Gary T. Leavens, Craig Chambers, and Todd Millstein. MultiJava: Modular open classes and symmetric multiple dispatch for Java. In OOPSLA 2000 Conference on Object-Oriented Programming, Systems, Languages, and Applications, Minneapolis, Minnesota, volume 35(10), pages 130–145, 2000.
Robert DeLine and Manuel Fähndrich. Enforcing high-level protocols in low-level software. In Proceedings of the ACM Conference on Programming Language Design and Implementation, pages 59–69, June 2001.
Dawson Engler, Benjamin Chelf, Andy Chou, and Seth Hallem. Checking system rules using system-specific, programmer-written compiler extensions. In Proceedings of Fourth Usenix Symposium on Operating Systems Design and Implementation, San Diego, California, October 2000.
Robert Bruce Findler, Cormac Flanagan, Matthew Flatt, Shriram Krishnamurthi, and Matthias Felleisen. DrScheme: A pedagogic programming environment for Scheme. In Proc. International Symposium on Programming Languages: Implementations, Logics, and Programs, pages 369–388, 1997.
Cormac Flanagan, K. Rustan M. Leino, Mark Lillibridge, Greg Nelson, James B. Saxe, and Raymie Stata. Extended static checking for Java. In Proc. of the ACM SIGPLAN’ 02 Conference on Programming Language Design and Implementation (PLDI), pages 234–245, Berlin, Germany, June 2002.
Matthew Flatt, Shriram Krishnamurthi, and Matthias Felleisen. Classes and mixins. In Conference Record ofPOPL98:The25THACMSIGPLAN-SIGACTSymposium on Principles of Programming Languages, San Diego, California, pages 171–183, New York, NY, 1998.
D. K. Frayne and Keith Playford. The Java syntactic extender (JSE). In Proceedings of the 2001 Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA’ 01), pages 31–42, Tampa, FL, USA, 2001.
Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. AddisonWesley, Reading, MA, 1994.
James Gosling, Bill Joy, and Guy Steele. The Java Language Specification. Addison-Wesley, August 1996. ISBN 0-201-63451-1.
Carl Gunter and John C. Mitchell, editors. Theoretical aspects of object-oriented programming. MIT Press, 1994.
Görel Hedin and Eva Magnusson. JastAdd-an aspect-oriented compiler construction system. Science of Computer Programming, 47(1):37–58, November 2002.
Scott E. Hudson, Frank Flannery, C. Scott Ananian, Dan Wang, and Andrew Appel. CUP LALR parser generator for Java, 1996. Software release. Located at http://www.cs.princeton.edu/~appel/modern/java/CUP/.
Yuuji Ichisugi and Yves Roudier. The extensible Java preprocessor kit and a tiny data-parallel Java. In Proc. ISCOPE’ 97, LNCS 1343, pages 153–160. Springer, 1997.
Richard Kelsey, William Clinger, and Jonathan Rees (editors). Revised5 report on the algorithmic language Scheme. ACM SIGPLAN Notices, 33(9):26–76, October 1998. Available at http://www.schemers.org/Documents/Standards/R5RS.
Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Videira Lopes, Jean-Marc Loingtier, and John Irwin. Aspect-oriented programming. In Proceedings of 11th European Conference on Object-Oriented Programming (ECOOP’97), number 1241 in Lecture Notes in Computer Science, pages 220–242, Jyväskylä, Finland, June 1997. Springer-Verlag.
Joseph R. Kiniry and Elaine Cheong. JPP: A Java pre-processor. Technical Report CS-TR-98-15, California Institute of Technology, Pasadena, CA, September 1998.
Shriram Krishnamurthi, Matthias Felleisen, and Daniel P. Friedman. Synthesizing objectoriented and functional design to promote re-use. In Proc. ECOOP’ 98, pages 91–113, 1998.
Gary T. Leavens, K. Rustan M. Leino, Erik Poll, Clyde Ruby, and Bart Jacobs. JML: notations and tools supporting detailed design in Java. In OOPSLA 2000 Companion, pages 105–106, Minneapolis, Minnesota, 2000.
Jed Liu and Andrew C. Myers. JMatch: Abstract iterable pattern matching for Java. In Proc. 5th Int’l Symp. on Practical Aspects of Declarative Languages, New Orleans, LA, January 2003.
Todd Millstein, Colin Bleckner, and Craig Chambers. Modular typechecking for hierarchically extensible datatypes and functions. In Proc. 7th ACM SIGPLAN International Conference on Functional Programming (ICFP), pages 110–122, Philadelphia, PA, USA, October 2002.
Andrew C. Myers. JFlow: Practical mostly-static information flowcontrol. In Proc. 26thACM Symp. on Principles of Programming Languages (POPL), pages 228–241, San Antonio, TX, January 19991.
Andrew C. Myers, Joseph A. Bank, and Barbara Liskov. Parameterized types for Java. In Proc. 24th ACM Symp. on Principles of Programming Languages (POPL), pages 132–145, Paris, France, January 1997.
Martin Odersky and Philip Wadler. Pizza into Java: Translating theory into practice. In Proc. 24th ACM Symp. on Principles of Programming Languages (POPL), pages 146–159, Paris, France, January 1997.
Terence Parr and Russell Quong. ANTLR: A predicated-LL(k) parser generator. Journal of Software Practice and Experience, 25(7), 1995.
John C. Reynolds. User-defined types and procedural data structures as complementary approaches to data abstraction. In Stephen A. Schuman, editor, New Directions in Algorithmic Languages, pages 157–168. Institut de Recherche d’Informatique et d’Automatique, Le Chesnay, France, 1975. Reprinted in [15], pages 13–23.
Richard Snodgrass. The Scorpion system, August 1995. Software release. Located at ftp://ftp.cs.arizona.edu/scorpion.
Richard Snodgrass and Karen Shannon. Supporting flexible and efficient tool integration. In Proceedings of the InternationalWorkshop on Advanced Programming Environments, number 244 in Lecture Notes in Computer Science, pages 290–313, Trondheim, Norway, June 1986.
Sun Microsystems. Java Language Specification, version 1.0 beta edition, October 1995. Available at ftp://ftp.javasoft.com/docs/javaspec.ps.zip.
Michiaki Tatsubori, Shigeru Chiba, Marc-Oliver Killijian, and Kozo Itano. OpenJava: A class-based macro system for Java. In Walter Cazzola, Robert J. Stroud, and Francesco Tisato, editors, Reflection and Software Engineering, LNCS 1826, pages 119–135. Springer-Verlag, July 2000.
J. Vlissides. Visitors in frameworks. C++ Report, 11(10), November 1999.
R. P. Wilson, R. S. French, C. S. Wilson, S. P. Amarasinghe, J. M. Anderson, S.W. K. Tjiang, S.-W. Liao, C.-W. Tseng, M. W. Hall, M. S. Lam, and J. L. Hennessy. SUIF: An infrastructure for research on parallelizing and optimizing compilers. SIGPLAN Notices, 29(12):31–37, 1994.
Steve Zdancewic, Lantian Zheng, Nathaniel Nystrom, and Andrew C. Myers. Untrusted hosts and confidentiality: Secure program partitioning. In Proc. 18th ACM Symp. on Operating System Principles (SOSP), pages 1–14, Banff, Canada, October 2001.
Matthias Zenger and Martin Odersky. Extensible algebraic datatypes with defaults. In Proc. 6th ACM SIGPLAN International Conference on Functional Programming (ICFP), Firenze, Italy, September 2001.
Matthias Zenger and Martin Odersky. Implementing extensible compilers. In ECOOPWorkshop on Multiparadigm Programming with Object-Oriented Languages, Budapest, Hungary, June 2001.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2003 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Nystrom, N., Clarkson, M.R., Myers, A.C. (2003). Polyglot: An Extensible Compiler Framework for Java. In: Hedin, G. (eds) Compiler Construction. CC 2003. Lecture Notes in Computer Science, vol 2622. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-36579-6_11
Download citation
DOI: https://doi.org/10.1007/3-540-36579-6_11
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-00904-7
Online ISBN: 978-3-540-36579-2
eBook Packages: Springer Book Archive