Compiler Plugins Can Handle Nested Languages: AST-Level Expansion of LINQ Queries for Java | SpringerLink
Skip to main content

Compiler Plugins Can Handle Nested Languages: AST-Level Expansion of LINQ Queries for Java

  • Conference paper
Object Databases (ICOODB 2009)

Part of the book series: Lecture Notes in Computer Science ((LNISA,volume 5936))

Included in the following conference series:

  • 350 Accesses

Abstract

The integration of database and programming languages is made difficult by the different data models and type systems prevalent in each field. Functional-object query languages contribute to bridge this gap by letting software developers write declarative queries without imposing any specific execution strategy. Although some query optimizers support this paradigm, Java provides no means to embed queries in a seamless and typesafe manner. Interestingly, the benefits of such grammar extension (compile-time type inference and checking, user-friendly syntax) can alternatively be achieved with a compiler plugin as discussed in this paper for the LINQ query language and two Java compilers (from Sun and Eclipse). A prototype confirms the benefits of the approach by automating at compile-time (a) the parsing of LINQ queries nested in Java, (b) their analysis for well-formedness, and (c) their rewriting into statements to build Abstract Syntax Trees (ASTs). The technique is also applicable to other languages (JPQL, XQuery) which are handled nowadays by a Java compiler as uninterpreted strings, being thus prone to runtime exceptions due to breaches of static semantics.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
¥17,985 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
JPY 3498
Price includes VAT (Japan)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
JPY 5719
Price includes VAT (Japan)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
JPY 7149
Price includes VAT (Japan)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Jones, S.P., Wadler, P.: Comprehensive Comprehensions. In: Proc. of the ACM SIGPLAN Workshop Haskell 2007, pp. 61–72. ACM Press, New York (2007), http://research.microsoft.com/~simonpj/papers/list-comp/list-comp.pdf

    Chapter  Google Scholar 

  2. Bruno, N., Castro, P.: Towards declarative queries on adaptive data structures. In: ICDE, pp. 1249–1258. IEEE, Los Alamitos (2008)

    Google Scholar 

  3. Grust, T., Scholl, M.H.: Translating OQL into Monoid Comprehensions—Stuck with Nested Loops? Technical Report 3a/1996, Database Research Group, Univ Konstanz (September 1996)

    Google Scholar 

  4. Cooper, E., Lindley, S., Wadler, P., Yallop, J.: Links: web programming without tiers. In: de Boer, F.S., Bonsangue, M.M., Graf, S., de Roever, W.-P. (eds.) FMCO 2006. LNCS, vol. 4709, pp. 266–296. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  5. Manolescu, D., Beckman, B., Livshits, B.: Volta: Developing distributed applications by recompiling. IEEE Softw. 25(5), 53–59 (2008)

    Article  Google Scholar 

  6. Wiedermann, B., Ibrahim, A., Cook, W.R.: Interprocedural query extraction for transparent persistence. SIGPLAN Not. 43(10), 19–36 (2008)

    Article  Google Scholar 

  7. Microsoft Corporation: Standard Query Operators Overview (2009), http://msdn.microsoft.com/en-us/library/bb397896.aspx

  8. Kabanov, J., Raudjärv, R.: Embedded typesafe domain specific languages for Java. In: PPPJ 2008: Proc. of the 6th Intnl. Symp. on Principles and Practice of Programming in Java, pp. 189–197. ACM, New York (2008), http://www.ekabanov.net/kabanov-raudjarv-pppj08.pdf

    Chapter  Google Scholar 

  9. Berler, M., Eastman, J., Jordan, D., Russell, C., Schadow, O., Stanienda, T., Velez, F.: The object data standard: ODMG 3.0. Morgan Kaufmann Publishers Inc., San Francisco (2000)

    Google Scholar 

  10. Bierman, G., Trigoni, A.: Towards a formal type system for ODMG OQL. Technical Report 497, University of Cambridge Computer Laboratory (September 2000), http://research.microsoft.com/~gmb/papers/tr497.pdf

  11. Garcia, M.: Formalizing the well-formedness rules of EJB3QL in UML + OCL. In: Kühne, T. (ed.) MoDELS 2006. LNCS, vol. 4364, pp. 66–75. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  12. Garcia, M.: Automating the embedding of Domain Specific Languages in Eclipse JDT. Eclipse Technical Article (2008), http://eclipse.org/articles/article.php?file=Article-AutomatingDSLEmbed dings/index.html

    Google Scholar 

  13. Adya, A., Blakeley, J.A., Melnik, S., Muralidhar, S.: Anatomy of the ADO.NET Entity Framework. In: SIGMOD 2007: Proc. of the 2007 ACM SIGMOD Intnl. Conf. on Mgmt. of Data, pp. 877–888. ACM, New York (2007)

    Chapter  Google Scholar 

  14. Melnik, S., Adya, A., Bernstein, P.A.: Compiling mappings to bridge applications and databases. In: SIGMOD 2007: Proc. of the 2007 ACM SIGMOD Intnl. Conf. on Mgmt. of Data, pp. 461–472. ACM, New York (2007)

    Chapter  Google Scholar 

  15. Gray, P.M.D., Kerschberg, L., King, P.J., Poulovassilis, A. (eds.): The Functional Approach to Data Management: Modeling, Analyzing, and Integrating Heterogeneous Data. Springer, Heidelberg (2004)

    MATH  Google Scholar 

  16. Jones, S.P.: The Implementation of Functional Programming Languages. Prentice-Hall, Inc., NJ (1987), http://research.microsoft.com/en-us/um/people/simonpj/papers/slpj-book-1987/

    MATH  Google Scholar 

  17. Grust, T., Mayr, M., Rittinger, J.: XQuery join graph isolation. In: Proc. of the 25th Intnl. Conf. on Data Engineering (ICDE 2009), Shanghai, China, March/April (2009), http://arxiv.org/abs/0810.4809

  18. Diao, Y.: Implementing memoization in a streaming XQuery processor. In: Bellahsène, Z., Milo, T., Rys, M., Suciu, D., Unland, R. (eds.) XSym 2004. LNCS, vol. 3186, pp. 35–50. Springer, Heidelberg (2004)

    Google Scholar 

  19. Willis, D., Pearce, D.J., Noble, J.: Caching and incrementalisation in the Java Query Language. In: OOPSLA 2008: Proc. of the 23rd ACM SIGPLAN Conf. on Object-oriented Programming Systems, Languages and Applications, pp. 1–18. ACM, New York (2008)

    Chapter  Google Scholar 

  20. Garcia, M., Möller, R.: Incremental Evaluation of OCL Invariants in the Essential MOF Object Model. In: Kühne, T., Reisig, W., Steimann, F. (eds.) Modellierung 2008. GI-Edition Lecture Notes in Informatics, vol. 127, pp. 11–26 (2008)

    Google Scholar 

  21. Turbak, F.A., Gifford, D.K.: Design Concepts in Programming Languages. MIT Press, Cambridge (2008)

    Google Scholar 

  22. Parr, T.: The Definitive ANTLR Reference: Building Domain-Specific Languages. The Pragmatic Programmers (2007)

    Google Scholar 

  23. Moerkotte, G.: Building Query Compilers, Draft (2009), http://pi3.informatik.uni-mannheim.de/~moer/querycompiler.pdf

  24. Mehra, K.K., Rajamani, S.K., Sistla, A.P., Jha, S.K.: Verification of object relational maps. In: SEFM 2007: Proc. of the Fifth IEEE Intnl. Conf. on Software Engineering and Formal Methods, Washington, DC, USA, pp. 283–292. IEEE Computer Society, Los Alamitos (2007)

    Chapter  Google Scholar 

  25. Microsoft Corporation: C# version 3.0 language specification (2007), http://msdn.microsoft.com/en-us/vcsharp/aa336809.aspx

  26. Garcia, M.: Formalization of QVT-Relations: OCL-based Static Semantics and Alloy-based Validation. In: Proc. of the 2nd Workshop on MDSD Today, October 2008, pp. 21–30. Shaker Verlag (2008), http://www.sts.tu-harburg.de/people/mi.garcia/pubs/2008/qvtr/QVTRelationsFormalization.pdf

  27. Cook, W.R., Rai, S.: Safe Query Objects: statically typed objects as remotely executable queries. In: ICSE 2005: Proc. of the 27th Intnl. Conf. on Software Engineering, pp. 97–106. ACM, New York (2005)

    Google Scholar 

  28. Erni, D., Kuhn, A.: The Hacker’s Guide to javac. Technical report, Software Composition Group (SCG), University of Bern, Switzerland (August 2008), http://www.iam.unibe.ch/~scg/Archive/Projects/Erni08b.pdf

  29. Wyk, E.V., Krishnan, L., Bodin, D., Schwerdfeger, A.: Attribute grammar-based language extensions for Java. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 575–599. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  30. Ekman, T., Hedin, G.: The JastAdd extensible Java compiler. In: OOPSLA 2007: Proc. of the 22nd ACM SIGPLAN Conf. on Object Oriented Programming Systems and Applications, pp. 1–18. ACM, New York (2007)

    Chapter  Google Scholar 

  31. Visser, J.: Matching Objects without Language Extension. Journal of Object Technology 5(8), 81–100 (2006)

    Google Scholar 

  32. Frenzel, L.: LTK: an API for automated refactorings in Eclipse IDEs (2006), Technical Article, http://www.eclipse.org/articles/Article-LTK/ltk.html

  33. Jones, S.P.: 24 (Beautiful Concurrency). In: Beautiful Code: Leading Programmers Explain How They Think. O’Reilly Media, Inc., Sebastopol (2007)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Garcia, M. (2010). Compiler Plugins Can Handle Nested Languages: AST-Level Expansion of LINQ Queries for Java. In: Norrie, M.C., Grossniklaus, M. (eds) Object Databases. ICOODB 2009. Lecture Notes in Computer Science, vol 5936. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-14681-7_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-14681-7_3

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-14680-0

  • Online ISBN: 978-3-642-14681-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics