Book a Demo

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kajal

Pages: [1]
1
Hello Eve,

This is the resulting AST: https://imgur.com/a/VRZbPGF

Thank you for your help  :)

2
Goal: To be able to import and reverse engineer Gosu code into Enterprise Architect. Gosu is a language based off of Java.

Method: Enterprise Architect provides reverse engineering support for a number of popular programming languages. However, if the language you are using is not supported, you can write your own grammar for it, using the in-built Grammar Editor. You can then incorporate the grammar into an MDG Technology to provide both reverse engineering support for your target language (source).

Problem: When I reverse engineer Gosu code, the classes get created correctly. The fields also get created in the diagram with the correct icon, type, and scope but the field’s name does not show up. It looks like this:

https://imgur.com/72z05E7 code being reverse engineered ----------> https://imgur.com/a/JVXzBv2

Steps Taken (not including debugging steps):
1.   Add Coding data types for the new language
2.   Create the grammar for the language
3.   Make the profiles and the model patterns
4.   Create the MDG
5.   Import the MDG into a new project. Create a diagram using the newly created MDG.
6.   Import Gosu code and reverse engineer.

How I’ve tried to debug:
-   I used the Grammar Debugger in EA’s grammar editor throughout the process.
-   Stepped through the ‘Profiler Results’ to make sure the correct sequence of events was taking place (it was).
-   Looked through the Sparx Forum for similar cases (couldn’t find anything).
-   Created a diagram to replicate the AST node information found here. Made sure the correct Nodes and sub-nodes are being created (with the multipolicy in mind).
-   I have been deleting and recreating the MDG xml after I update the grammar to make sure that it’s using the correct grammar file.
-   I’ve tried a lot of debugging strategies, including reaching out to a coworker. After all the debugging I think the AST is correct. Most notably because:
o   I imported the sample Java grammar provided by EA and used the Grammar Debugger to look at the AST. The ASTs created by the java grammar and the Gosu grammar were identical. When I reverse engineered the same piece of code (as the in the screenshot above) by selecting the Java option, the field’s name (and all other information) shows up as expected in the diagram.

My Conclusion:
-   As stated earlier, I think the grammar and AST tree is correct. The issue might be:
o   Occurring when the AST is converted into the diagram. Is there any way to get insight into this process?
o   There is a problem with the way my MDG is defined. I’m not sure what the link is between the MDG profiles and the reverse engineering. To my knowledge, the MDG just allows for a grammar to be defined but isn’t related to the reverse engineering process. Is this correct?

If you think you can help me then I can email you the:
-   xml for the MDG I created.
-   Gosu grammar file I created.

Please let me know if any further information would be useful. Thank you for your help!

Pages: [1]