Dissertaç ˜ao de Mestrado Mestrado em Engenharia Informática Jo ...
Dissertaç ˜ao de Mestrado Mestrado em Engenharia Informática Jo ...
Dissertaç ˜ao de Mestrado Mestrado em Engenharia Informática Jo ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
4. AN IMPLEMENTATION 4.6. Generation of Original Syntax<br />
!"#$%&'<br />
)*++<br />
(<br />
!"#$%&'<br />
,<br />
!"#$%&'<br />
-<br />
)*++<br />
Figure 4.3: List of TGRNo<strong>de</strong>s<br />
!"#$%&'<br />
!"#$%&'<br />
the grammar where the current was based on and a TGRNo<strong>de</strong> list next containing the gram-<br />
mars based on the current. An example is represented in Figure 4.3.<br />
To allow the user to traverse all the built grammars, the prev and next methods resort to<br />
each grammar serial number to iterate the grammars backwards/forwards. Each method may<br />
also return null if no grammar was built before/after the current one, respectively. The get<br />
method receives an integer representing the <strong>de</strong>sired grammar serial number and returns the<br />
respective Grammar.<br />
The discard method <strong>de</strong>letes a grammar from the database, and every grammar based on<br />
that one. The discardAll <strong>em</strong>pties the list of tentative grammars. To save the state of the<br />
database, the gramar list is stored to disk.<br />
4.6 Generation of Original Syntax<br />
The generation of original syntax consists on printing a file on generic syntax back to its original<br />
syntax by means of a Printer component. When a file is transposed from its original syntax,<br />
say INI, to the generic syntax (XML), the language-specific <strong>de</strong>tails, like the ‘[’ and ‘]’ hea<strong>de</strong>r<br />
<strong>de</strong>limiters, are discar<strong>de</strong>d to allow for application-in<strong>de</strong>pen<strong>de</strong>nt configuration. Furthermore, the<br />
format of each pattern is also lost. Only the relevant information for the configuration process,<br />
such as parameter keys and values, is kept.<br />
When the printer tries to print the file in generic syntax back to its original form, it will<br />
46<br />
/<br />
.<br />
)*++<br />
)*++