Transformation of Applicative Specifications into Imperative ...

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

26.09.2013 Views

APPENDIX F. SOURCE CODE public void visitOVERRIDE (OVERRIDE r s l _ o v e r r i d e ) { r e s u l t . append ( " ! ! " ) ; } public void visitCOMPOSITION(COMPOSITION rsl_composition ) { r e s u l t . append ( "#" ) ; } public void visitIMPLIES (IMPLIES i m p l i e s ) { r e s u l t . append ( "=>" ) ; } public void visitOR (OR or ) { r e s u l t . append ( " \ \ / " ) ; } public void visitAND (AND and ) { r e s u l t . append ( " / \ \ " ) ; } public void visitABS (ABS rsl_abs ) { r e s u l t . append ( " abs " ) ; } public void visitINTCAST (INTCAST r s l _ i n t c a s t ) { r e s u l t . append ( " i n t " ) ; } public void visitREALCAST (REALCAST r s l _ r e a l c a s t ) { r e s u l t . append ( " r e a l " ) ; } public void visitLEN (LEN r s l _ l e n ) { r e s u l t . append ( " l e n " ) ; } public void visitINDS (INDS r s l _ i n d s ) { r e s u l t . append ( " inds " ) ; } public void visitELEMS (ELEMS rsl_elems ) { r e s u l t . append ( " elems " ) ; } public void visitHD (HD rsl_hd ) { r e s u l t . append ( "hd " ) ; } public void visitTL (TL r s l _ t l ) { 548

} r e s u l t . append ( " t l " ) ; public void visitNOT (NOT rsl_not ) { r e s u l t . append ( "~" ) ; } F.2. VISITOR MODULES public void visitPREFIXMINUS (PREFIXMINUS r s l _ p r e f i x m i n u s ) { r e s u l t . append ( "−" ) ; } public void visitPREFIXPLUS (PREFIXPLUS p r e f i x p l u s ) { r e s u l t . append ( "+" ) ; } public void visitCARD (CARD rsl_card ) { r e s u l t . append ( " card " ) ; } public void visitDOM (DOM rsl_dom ) { r e s u l t . append ( "dom " ) ; } public void visitRNG (RNG rsl_rng ) { r e s u l t . append ( " rng " ) ; } public void v i s i t L e t D e f ( LetDef l e t D e f ) { l e t D e f . binding ( ) . accept ( this ) ; r e s u l t . append ( " = " ) ; l e t D e f . value_expr ( ) . accept ( this ) ; } public void visitMakeBinding ( MakeBinding binding ) { binding . binding ( ) . accept ( this ) ; } public void visitMakeRecordPattern ( MakeRecordPattern recordPattern ) { recordPattern . value_or_variable_name ( ) . accept ( this ) ; r e s u l t . append ( " ( " ) ; for ( Pattern pattern : recordPattern . i n n e r _ p a t t e r n _ l i s t ( ) . g e t L i s t ( ) ) { pattern . accept ( this ) ; r e s u l t . append ( " , " ) ; } i f ( recordPattern . i n n e r _ p a t t e r n _ l i s t ( ) . l e n ( ) > 0) { r e s u l t . d e l e t e ( r e s u l t . l ength ( ) − 2 , r e s u l t . length ( ) ) ; } 549

}<br />

r e s u l t . append ( " t l " ) ;<br />

public void visitNOT (NOT rsl_not ) {<br />

r e s u l t . append ( "~" ) ;<br />

}<br />

F.2. VISITOR MODULES<br />

public void visitPREFIXMINUS (PREFIXMINUS r s l _ p r e f i x m i n u s ) {<br />

r e s u l t . append ( "−" ) ;<br />

}<br />

public void visitPREFIXPLUS (PREFIXPLUS p r e f i x p l u s ) {<br />

r e s u l t . append ( "+" ) ;<br />

}<br />

public void visitCARD (CARD rsl_card ) {<br />

r e s u l t . append ( " card " ) ;<br />

}<br />

public void visitDOM (DOM rsl_dom ) {<br />

r e s u l t . append ( "dom " ) ;<br />

}<br />

public void visitRNG (RNG rsl_rng ) {<br />

r e s u l t . append ( " rng " ) ;<br />

}<br />

public void v i s i t L e t D e f ( LetDef l e t D e f ) {<br />

l e t D e f . binding ( ) . accept ( this ) ;<br />

r e s u l t . append ( " = " ) ;<br />

l e t D e f . value_expr ( ) . accept ( this ) ;<br />

}<br />

public void visitMakeBinding ( MakeBinding binding ) {<br />

binding . binding ( ) . accept ( this ) ;<br />

}<br />

public void visitMakeRecordPattern ( MakeRecordPattern recordPattern )<br />

{<br />

recordPattern . value_or_variable_name ( ) . accept ( this ) ;<br />

r e s u l t . append ( " ( " ) ;<br />

for ( Pattern pattern :<br />

recordPattern . i n n e r _ p a t t e r n _ l i s t ( ) . g e t L i s t ( ) ) {<br />

pattern . accept ( this ) ;<br />

r e s u l t . append ( " , " ) ;<br />

}<br />

i f ( recordPattern . i n n e r _ p a t t e r n _ l i s t ( ) . l e n ( ) > 0) {<br />

r e s u l t . d e l e t e ( r e s u l t . l ength ( ) − 2 , r e s u l t . length ( ) ) ;<br />

}<br />

549

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

Saved successfully!

Ooh no, something went wrong!