Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...

26.09.2013 Views

APPENDIX A. USING AND EXTENDING THE TRANSFORMER A.2 Using the Transformer In order to transform a specification using the transformer the following command must be executed: java translator.RSLRunner RSL-file new-RSL-file [variable-list] where RSL-file is the name of an RSL file without the .rsl extension. new-RSL-file is the the file name without the .rsl extension to which the transformed specification is written. variable-list is a list of the form var1:type1 var2:type2... where var1 is the name of the variable that type1 should be represented by and so on. A.3 Extending the Transformer To extend the transformer the following programs need to be installed: • ANTLR, which can be found in www.antlr.org. • The RSL2Java tool, [Hja04]. An extension requires the following steps. The directories mentioned are relative to the source_code directory, which can be found on the enclosed CD-ROM. • Extension of the lexer and parser, which means an extension of the ANTLR grammar file translator\syntacticanalyzer\rsltorslast.g. • Extension of the RSL AST specification, RSLAst_Module.rsl. • Extension of the transformer specification, TransformerRSL1.rsl. • Extension of the visitor modules, translator\lib\RSLAstVisitor.java and translator\lib\StringRSLAstVisitor.java. When these extensions have been done the transformer must be generated. This is done as follows. • Generation of the lexer and the parser by executing the command java antlr.Tool rsltorslast.g in the directory translator\syntacticanalyzer. • Translation of the RSL AST into Java by executing the command java translator.Runner2 RSLAst_Module rslast.properties in the source_code directory. 136

A.3. EXTENDING THE TRANSFORMER • Translation of the transformer specification into Java by executing the command java translator.Runner2 TransformerRSL1 transformer.properties in the source_code directory. • Compiling all the Java source code by executing the command javac translator/lib/*.java translator/rslast/*.java translator/rsllib/*.java translator/*.java translator/syntacticanalyzer/*.java translator/rsltransformer/*.java in the source_code directory. An overview of the packages of the program and the destinations of the generated Java files can be found in Figure A.1 on the following page. 137

A.3. EXTENDING THE TRANSFORMER<br />

• Translation <strong>of</strong> the transformer specification <strong>into</strong> Java by executing the<br />

command<br />

java translator.Runner2 TransformerRSL1 transformer.properties<br />

in the source_code directory.<br />

• Compiling all the Java source code by executing the command<br />

javac translator/lib/*.java<br />

translator/rslast/*.java<br />

translator/rsllib/*.java<br />

translator/*.java<br />

translator/syntacticanalyzer/*.java<br />

translator/rsltransformer/*.java<br />

in the source_code directory.<br />

An overview <strong>of</strong> the packages <strong>of</strong> the program and the destinations <strong>of</strong> the<br />

generated Java files can be found in Figure A.1 on the following page.<br />

137

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!