26.09.2013 Views

Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

APPENDIX F. SOURCE CODE<br />

System . e x i t ( 1 ) ;<br />

}<br />

try {<br />

+ f i l e n a m e<br />

+ " . r s l not found ! " ) ;<br />

System . out . p r i n t l n ( " S t a r t i n g : " + f i l e n a m e ) ;<br />

System . out . p r i n t l n ( " S t a r t i n g p a r s i n g " ) ;<br />

RSLLexer l e x e r = new RSLLexer ( f r ) ;<br />

RSLParser p a r s e r = new RSLParser ( l e x e r ) ;<br />

RSLAst a r s l a s t = p a r s e r . r s l a s t ( ) ;<br />

i f ( a r s l a s t == null ) {<br />

System . out . p r i n t l n ( " Tree not c r e a t e d ! " ) ;<br />

System . e x i t ( 1 ) ;<br />

}<br />

System . out . p r i n t l n ( "Ending p a r s i n g \n" ) ;<br />

try {<br />

StringRSLAstVisitor a r s l A s t V i s i t o r =<br />

new StringRSLAstVisitor ( ) ;<br />

a r s l a s t . accept ( a r s l A s t V i s i t o r ) ;<br />

}<br />

catch ( NullPointerException npe ) {<br />

System . out . p r i n t l n ( " Tree not c r e a t e d "<br />

+ " c o r r e c t ! \ n"<br />

+ "The RSL "<br />

+ " s p e c i f i c a t i o n "<br />

+ " i s not "<br />

+ " within the "<br />

+ " subset o f RSL" ) ;<br />

System . e x i t ( 1 ) ;<br />

}<br />

F i l e f i l e = new F i l e ( f i l e n a m e ) ;<br />

try {<br />

TRResult r e s u l t =<br />

TransformerRSL1 .<br />

TRRSLAst( a r s l a s t ,<br />

newFilename ,<br />

new TRANS( v a r i a b l e s ) ) ;<br />

i f ( r e s u l t instance<strong>of</strong> RSLast_transformable ) {<br />

System . out . p r i n t l n ( " Transformable " ) ;<br />

510

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

Saved successfully!

Ooh no, something went wrong!