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 and code synchronization support for your target language.
The framework for writing a grammar and importing it into Enterprise Architect is the direct complement to the Code Template Framework. While code templates are for converting a model to a textual form, grammars are required to convert text to a model. Both are required to synchronize changes into your source files.
An example language source file and an example Grammar for that language are provided in the Code Samples directory, which you can access from your installation directory (the default location is C:\Program Files\Sparx Systems\EA). Two other grammar files are also provided, illustrating specific aspects of developing Grammars.
Grammars define how a text is to be broken up into a structure, which is necessary when you are converting code into a UML representation. At the simplest level, a grammar is instructions for breaking up an input to form a structure.
Enterprise Architect uses a variation of Backus–Naur Form (nBNF) to include processing instructions, the execution of which returns structured information from the parsed results in the form of an Abstract Syntax Tree (AST), which is used to generate a UML representation.
The Grammar Editor is an in-built editor that you can use to open, edit, validate and save grammar files.
You can debug the grammar files you create using two facilities:
|Parsing AST Results Profiling Grammar Parsing