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.
3. AN APPLICATION RECONFIGURATION FRAMEWORK 3.3. Original to Generic syntax Converter<br />
Presentation Layer<br />
User<br />
Interface<br />
Logical Layer<br />
Configuration<br />
File Parser<br />
Storage Layer<br />
Parser<br />
Repository<br />
Co<strong>de</strong><br />
Generator<br />
Presentation Layer<br />
Logical Layer<br />
Storage Layer<br />
Figure 3.4: Interactions on the successful file recognition scenario<br />
2. The Configuration File Parser gets the parsers from the Parser Repository<br />
and tests the configuration file with all of th<strong>em</strong>. By assumption, at least one parser is<br />
able to parse the configuration file entirely, therefore, at least one valid AST for the entire<br />
configuration file is produced;<br />
3. The Configuration File Parser sends the generated ASTs to the Co<strong>de</strong> Generator<br />
and returns User Interface the generic syntax of the file for each parser;<br />
4. Finally, the User Interface chooses a valid file in generic syntax and stores it to disk.<br />
On the other hand, if a configuration file is new to the tool, the process requires more com-<br />
ponents to operate. The previous process is performed normally until step 2, where no parser<br />
was found to be able to parse the configuration file by the User Interface. Afterwards, the<br />
action flow is as follows:<br />
1. The user must build a grammar through the User Interface so that the Grammar<br />
Compiler generates a parser from it. If a grammar <strong>de</strong>claration is not valid or if the<br />
generated parser still cannot parse the configuration file, another grammar must be built<br />
until the configuration file is parsed;<br />
2. Meanwhile, every grammar produced by the user is stored in the Tentative Grammar<br />
Repository for the user to easily rollback any change ma<strong>de</strong> to a grammar;<br />
3. When a parser successfully recognizes a configuration file, the user has the last word as<br />
he may approve or disapprove the structure produced by that parser;<br />
4. If the user does not approve of a parser, another one must naturally be generated;<br />
32