Question

ATL is a transformation language that allows to make model to model transformations, but I want to know if with this transformation language it's possible to make text to model transformation (already having a defined Ecore metamodel) or I must have to do with another transformation language.

If it is not possible with ATL, what is the transformation language?

Was it helpful?

Solution

This is called "reverse engineering" or "design recovery" depending on how abstract your model is.

To transform "text" to a model, you need a parser for that text, whatever it is. Typically that text is for a programming language in its full glory. If your text is COBOL, Java, or C++, you need full parsers for those languages and they are not easy to build, as these languages are big, complex, and less well-documented than you would think, and then you get to deal with vendor-specific variants.

A parser isn't enough, either. Model elements represent entities with relationships between them (e.g., classes with "contains", "uses", "calls" relationships). These relationships need to be extracted from the code, thus requiring static analysis of the code to extract such facts. You have to write this analysis in "some" language.

An ideal tool for such a task is an program transformation (PT) system. These tools accept language defintions, parse source code building ASTs (a kind of compiler data structure) and make it possible to transform the code, and/or analyze it to extracts relations of interest, usually written in a DSL specific to the PT system. AFAIK, DMS (my company's PT system) is the only one with mature parsers for common languages. YMMV.

OTHER TIPS

EMFText, Xtext.

I used the first one to implement XPath 2 printer and parser. Also there are a lot of examples here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top