Extracting models from source code in software modernization


Model-driven software modernization is a discipline in which model-driven development (MDD) techniques are used in the modernization of legacy systems. When existing software artifacts are evolved, they must be transformed into models to apply MDD techniques such as model transformations. Since most modernization scenarios (e.g., application migration) involve dealing with code in general-purpose programming languages (GPL), the extraction of models from GPL code is an essential task in a model-based modernization process. This activity could be performed by tools to bridge grammarware and MDD technical spaces, which is normally carried out by dedicated parsers. Grammar-to-Model Transformation Language (Gra2MoL) is a domain-specific language (DSL) tailored to the extraction of models from GPL code. This DSL is actually a text-to-model transformation language which can be applied to any code conforming to a grammar. Gra2MoL aims to reduce the effort needed to implement grammarware-MDD bridges, since building dedicated parsers is a complex and time-consuming task. Like ATL and RubyTL languages, Gra2MoL incorporates the binding concept needed to write mappings between grammar elements and metamodel elements in a simple declarative style. The language also provides a powerful query language which eases the retrieval of scattered information in syntax trees. Moreover, it incorporates extensibility and grammar reuse mechanisms. This paper describes Gra2MoL in detail and includes a case study based on the application of the language in the extraction of models from Delphi code.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16
Fig. 17
Fig. 18
Fig. 19
Fig. 20
Fig. 21
Fig. 22
Fig. 23
Fig. 24
Fig. 25


  1. 1.

    Heckel, R., Correia, R., Matos, C., El-Ramly, M., Koutsoukos, G., Andrade, L.: Architectural transformations: from legacy to three-tier and services. In: Mens, T., Demeyer, S. (eds.) Software Evolution, p. 170. Springer, Heidelberg (2008)

    Google Scholar 

  2. 2.

    Cánovas Izquierdo, J.L., García Molina, J.: An architecture-driven modernization tool for calculating metrics. IEEE Softw. 27, 37–43 (2010)

  3. 3.

    Andrade, L.F., Gouveia, J., Antunes, M., El-Ramly, M., Koutsoukos, G.: Forms2Net - migrating oracle forms to Microsoft. NET. In: Generative and Transformational Techniques in Software Engineering, pp. 261–277 (2006)

  4. 4.

    Reus, T., Geers, H., Deursen, A.: Harvesting software systems for MDA-based reengineering. In: European Conference on Model Driven Architecture: Foundations and Applications, LNCS, vol. 4066, pp. 213–225 (2006)

  5. 5.

    ADM initiative website. http://adm.omg.org. Accessed 6 March 2012

  6. 6.

    ADM Task Force: Architecture-driven modernization scenarios. OMG, USA (2006)

    Google Scholar 

  7. 7.

    Kurtev, I., Bézivin, J., Aksit, M.: Technological spaces: An initial appraisal. In: Cooperative Information Systems, DOA’2002 Federated Conferences, Industrial track (2002)

  8. 8.

    Xtext project. http://www.eclipse.org/Xtext. Accessed 6 March 2012

  9. 9.

    EMFText project. http://emftext.org. Accessed 6 March 2012

  10. 10.

    Czarnecki, K., Helsen, S.: Feature-based survey of model transformation approaches. IBM Syst. 45(3), 621–646 (2006)

    Google Scholar 

  11. 11.

    Jouault, F., Allilaire, F., Bézivin, J., Kurtev, I.: ATL: A model transformation tool. Sci. Comp. Program. 72(1–2), 31–39 (2008)

    Article  MATH  Google Scholar 

  12. 12.

    Heaton, L.: Meta Object Facility (MOF) Query/View/ Transformation Specification. OMG, New York (2005)

  13. 13.

    Sánchez Cuadrado, J., García Molina, J., Mernárguez Tortosa, M.: RubyTL: A practical, extensible transformation language. In: European Conference on Model Driven Architecture: Foundations and Applications, LNCS, vol. 4066, pp. 158–172 (2006)

  14. 14.

    Mofscript project. http://www.eclipse.org/gmt/mofscript. Accessed 6 March 2012

  15. 15.

    Xpand website. http://wiki.eclipse.org/Xpand. Accessed 6 March 2012

  16. 16.

    Cánovas Izquierdo, J.L., Sánchez Cuadrado, J., García Molina, J.: Gra2MoL: A domain specific transformation language for bridging grammarware to modelware in software modernization. In: Workshop Model Driven Software Evolution (2008)

  17. 17.

    Cánovas Izquierdo, J.L., García Molina, J.: A domain specific language for extracting models in software modernization. In: European Conference on Model Driven Architecture Foundations and Applications, LNCS, vol. 5562, pp. 82–97 (2009)

  18. 18.

    Gra2MoL website. http://modelum.es/gra2mol. Accessed 6 March 2012

  19. 19.

    Wijngaarden, J., Visser, E.: Program transformation mechanics: a classification of mechanisms for program transformation with a survey of existing transformation systems. Tech. Rep. UU-CS-2003-048. The Department of Information and Computing Sciences, Utrecht University, The Netherlands (2003)

    Google Scholar 

  20. 20.

    JDT Eclipse project. http://www.eclipse.org/jdt. Accessed 6 March 2012

  21. 21.

    MoDisco. http://www.eclipse.org/gmt/modisco. Accessed 6 March 2012

  22. 22.

    GMT Eclipse project. http://www.eclipse.org/gmt. Accessed 6 March 2012

  23. 23.

    KDM metamodel specification. http://www.omg.org/spec/KDM. Accessed 6 March 2012

  24. 24.

    Fowler, M.: Domain-Specific Languages. Addison Wesley, USA (2011)

    Google Scholar 

  25. 25.

    Scheidgen, M.: Textual Modelling Embedded into Graphical Modelling. In: European Conference on Model Driven Architecture Foundations and Applications, LNCS, vol. 4530, pp. 153–168 (2008)

  26. 26.

    Jouault, F., Bézivin, J., Kurtev, I.: TCS: a dsl for the specification of textual concrete syntaxes in model engineering. In: Generative Programming and Component, Engineering, pp. 249–254 (2006)

  27. 27.

    JAMOPP project. http://jamopp.inf.tu-dresden.de. Accessed 6 March 2012

  28. 28.

    Wimmer M., Kramler, G.: Bridging grammarware and modelware. In: Satellite Events at the MoDELS 2005 Conference, pp. 159–168 (2006)

  29. 29.

    Kunert, A.: Semi-automatic generation of metamodels and models from grammars and programs. In: Fifth International Workshop on Graph Transformation and Visual Modeling Techniques. E. N. in Theorical Computer Science, vol. 211, pp. 111–119 (2008)

  30. 30.

    Prinz, A., Scheidgen, M., Tveit, M.S.: A model-based standard for SDL. In: International SDL Forum Conference on Design for Dependable Systems, pp. 1–18 (2007)

  31. 31.

    Stratego/XT. http://strategoxt.org. Accessed 6 March 2012

  32. 32.

    TXL. http://www.txl.ca. Accessed 6 March 2012

  33. 33.

    OCL constraint language. OMG (2006)

  34. 34.

    Wijngaarden, J.: Code Generation from a Domain Specific Language: M.Sc. Thesis (2003)

  35. 35.

    ASTM metamodel specification. http://www.omg.org/spec/ASTM Accessed 6 March 2012

  36. 36.

    Xpath. http://www.w3.org/TR/xpath. Accessed 6 March 2012

  37. 37.

    CDO project. http://www.eclipse.org/cdo. Accessed 6 March 2012

  38. 38.

    Czarnecki, K., Helsen, S.: Classification of model transformation approaches. In: Proceedings of the 2nd OOPSLA Workshop on Generative Technique in the Context of the Model Driven, Architecture (2003)

  39. 39.

    Espinazo-Pagán, J., Sánchez Cuadrado, J., García Molina, J.: Morsa: A scalable approach for persisting and accessing large models. In: International Conference on Model Driven Engineering Languages and Systems, pp. 77–92 (2011)

Download references


This work has been supported by the Spanish government (TIN2009-11555 project) and the Fundación Séneca of the Regional Government of Murcia (15389/PI/10 grant).

Author information



Corresponding author

Correspondence to Javier Luis Cánovas Izquierdo.

Additional information

Communicated by Dr. D. Tamzalit, B. Schätz, D. Deridder and A. Pierantonio.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Cánovas Izquierdo, J.L., García Molina, J. Extracting models from source code in software modernization. Softw Syst Model 13, 713–734 (2014). https://doi.org/10.1007/s10270-012-0270-z

Download citation


  • Model-driven engineering
  • Model-driven software development
  • Domain-specific languages
  • Software modernization
  • Model-driven software modernization