Approaches and Tools for Implementing Type Systems in Xtext

  • Lorenzo Bettini
  • Dietmar Stoll
  • Markus Völter
  • Serano Colameo
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7745)


With the Xtext framework, building domain specific languages (DSLs) integrated into the Eclipse IDE has become increasingly popular and viable even for non-trivial domains. However, sophisticated DSLs may require advanced type checking capabilities, since they usually include expressions, types and the notion of type conformance. In this paper we compare a number of approaches and frameworks for implementing type systems for Xtext languages regarding flexibility, required effort and usability. We use a common case study to illustrate the trade-offs between the various tools.


Type System Abstract Syntax Java Code Attribute Grammar Constraint Check 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
  2. 2.
  3. 3.
  4. 4.
    Bertot, Y., Castéran, P.P.: Interactive theorem proving and program development: Coq’Art: the calculus of inductive constructions. Texts in theoretical computer science. Springer (2004)Google Scholar
  5. 5.
    Bettini, L.: An Eclipse-based IDE for Featherweight Java implemented in Xtext. In: ECLIPSE-IT, pp. 14–28 (2010)Google Scholar
  6. 6.
    Bettini, L.: A DSL for Writing Type Systems for Xtext Languages. In: PPPJ, pp. 31–40. ACM (2011)Google Scholar
  7. 7.
    Bettini, L.: Xsemantics (2012),
  8. 8.
    Bettini, L., Damiani, F., Schaefer, I., Strocco, F.: TraitRecordJ: A programming language with traits and records. Science of Computer Programming (to appear, 2012)Google Scholar
  9. 9.
    Borras, P., Clement, D., Despeyroux, T., Incerpi, J., Kahn, G., Lang, B., Pascual, V.: CENTAUR: the system. SIGPLAN 24(2), 14–24 (1988)CrossRefGoogle Scholar
  10. 10.
    Van Den Brand, M.G.J., Heering, J., Klint, P., Olivier, P.A.: Compiling language definitions: the ASF+SDF compiler. ACM TOPLAS 24(4), 334–368 (2002)CrossRefGoogle Scholar
  11. 11.
    Bravenboer, M., Kalleberg, K.T., Vermaas, R., Visser, E.: Stratego/XT 0.17. A language and toolset for program transformation. Science of Computer Programming 72(1-2), 52–70 (2008)MathSciNetCrossRefGoogle Scholar
  12. 12.
    Cardelli, L.: Type Systems. ACM Computing Surveys 28(1), 263–264 (1996)CrossRefGoogle Scholar
  13. 13.
    Charles, P., Fuhrer, R., Sutton Jr., S., Duesterwald, E., Vinju, J.: Accelerating the creation of customized, language-Specific IDEs in Eclipse. In: OOPSLA. ACM (2009)Google Scholar
  14. 14.
    Clavel, M., Durán, F., Eker, S., Lincoln, P., Martí-Oliet, N., Meseguer, J., Talcott, C.: The Maude 2.0 System. In: Nieuwenhuis, R. (ed.) RTA 2003. LNCS, vol. 2706, pp. 76–87. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  15. 15.
    Dijkstra, A., Swierstra, S.D.: Ruler: Programming Type Rules. In: Hagiya, M. (ed.) FLOPS 2006. LNCS, vol. 3945, pp. 30–46. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  16. 16.
    Ekman, T., Hedin, G.: The JastAdd system – modular extensible compiler construction. Science of Computer Programming 69(1-3), 14–26 (2007)MathSciNetzbMATHCrossRefGoogle Scholar
  17. 17.
    Felleisen, M., Findler, R.B., Flatt, M.: Semantics Engineering with PLT Redex. The MIT Press, Cambridge (2009)zbMATHGoogle Scholar
  18. 18.
    Gordon, M.: From LCF to HOL: a short history. In: Proof, Language, and Interaction: Essays in Honour of Robin Milner, pp. 169–186. The MIT Press (2000)Google Scholar
  19. 19.
    Heidenreich, F., Johannes, J., Karol, S., Seifert, M., Wende, C.: Derivation and Refinement of Textual Syntax for Models. In: Paige, R.F., Hartman, A., Rensink, A. (eds.) ECMDA-FA 2009. LNCS, vol. 5562, pp. 114–129. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  20. 20.
    Hindley, J.R.: Basic Simple Type Theory. Cambridge University Press (1987)Google Scholar
  21. 21.
    Hofer, C., Ostermann, K., Rendel, T., Moors, A.: Polymorphic embedding of DSLs. In: Smaragdakis, Y., Siek, J.G. (eds.) Proceedings of the 7th International Conference on Generative Programming and Component Engineering, GPCE 2008, Nashville, TN, USA, October 19-23, pp. 137–148. ACM (2008)Google Scholar
  22. 22.
    Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001)CrossRefGoogle Scholar
  23. 23.
    Jouault, F., Bézivin, J., Kurtev, I.: TCS: a DSL for the specification of textual concrete syntaxes in model engineering. In: GPCE, pp. 249–254. ACM (2006)Google Scholar
  24. 24.
    Kats, L.C.L., Visser, E.: The Spoofax language workbench. Rules for declarative specification of languages and IDEs. In: OOPSLA, pp. 444–463. ACM (2010)Google Scholar
  25. 25.
    Levine, J.: flex & bison. O’Reilly Media (2009)Google Scholar
  26. 26.
    Mernik, M., Lenič, M., Avdicauševic, E., Zumer, V.: LISA: An Interactive Environment for Programming Language Development. In: Nigel Horspool, R. (ed.) CC 2002. LNCS, vol. 2304, pp. 1–4. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  27. 27.
    Object Management Group. Object Constraint Language, Version 2.2 (2010),
  28. 28.
    Parr, T.: The Definitive ANTLR Reference: Building Domain-Specific Languages. Pragmatic Programmers (2007)Google Scholar
  29. 29.
    Paulson, L.C.: Isabelle: A Generic Theorem Prover. LNCS, vol. 828. Springer, Heidelberg (1994)zbMATHCrossRefGoogle Scholar
  30. 30.
    Pfeiffer, M., Pichler, J.: A comparison of tool support for textual domain-specific languages. In: DSM, pp. 1–7 (2008)Google Scholar
  31. 31.
    Pierce, B.C.: Types and Programming Languages. The MIT Press (2002)Google Scholar
  32. 32.
    Reps, T., Teitelbaum, T.: The Synthesizer Generator. In: Software Engineering Symposium on Practical Software Development Environments, pp. 42–48. ACM (1984)Google Scholar
  33. 33.
    Schaefer, I., Bettini, L., Damiani, F.: Compositional Type-Checking for Delta-oriented Programming. In: AOSD, pp. 43–56. ACM (2011)Google Scholar
  34. 34.
    Sewell, P., Nardelli, F.Z., Owens, S., Peskine, G., Ridge, T., Sarkar, S., Strnisa, R.: Ott: Effective tool support for the working semanticist. J. Funct. Program 20(1) (2010)Google Scholar
  35. 35.
    Steinberg, D., Budinsky, F., Paternostro, M., Merks, E.: EMF: Eclipse Modeling Framework, 2nd edn. Addison-Wesley (2008)Google Scholar
  36. 36.
    Vlissides, J.: Generation Gap Pattern. C++ Report 8(10):12, 14–18 (1996)Google Scholar
  37. 37.
    Voelter, M.: Language and IDE Development, Modularization and Composition with MPS. In: 4th Summer School on Generative and Transformational Techniques in Software Engineering (GTTSE 2011). LNCS, Springer (2011)Google Scholar
  38. 38.
    Völter, M.: Xtext/TS - A Typesystem Framework for Xtext (May 2011),
  39. 39.
    Warmer, J., Kleppe, A.: The Object Constraint Language: Precise Modeling with UML. Addison Wesley (1999)Google Scholar
  40. 40.
    Van Wyk, E., Bodin, D., Gao, J., Krishnan, L.: Silver: an Extensible Attribute Grammar System. Electronic Notes in Theoretical Computer Science 203(2), 103–116 (2008)CrossRefGoogle Scholar
  41. 41.
    Xu, H.: EriLex: An Embedded Domain Specific Language Generator. In: Vitek, J. (ed.) TOOLS 2010. LNCS, vol. 6141, pp. 192–212. Springer, Heidelberg (2010)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Lorenzo Bettini
    • 1
  • Dietmar Stoll
    • 2
  • Markus Völter
    • 3
  • Serano Colameo
    • 2
  1. 1.Dipartimento di InformaticaUniversità di TorinoItaly
  2. 2.itemis Schweiz GmbHSwitzerland
  3. 3.independent/itemis AGGermany

Personalised recommendations