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 F.2 Visitor Modules RSLElement.java package t r a n s l a t o r . l i b ; import t r a n s l a t o r . r s l a s t . ∗ ; import t r a n s l a t o r . ∗ ; public abstract class RSLElement { } public abstract void accept ( RSLAstVisitor v i s i t o r ) ; RSLAstVisitor.java package t r a n s l a t o r . l i b ; import t r a n s l a t o r . r s l a s t . ∗ ; public abstract class RSLAstVisitor { public void visitRSLAst ( RSLAst r s l a s t ) { r s l a s t . libmodule ( ) . accept ( this ) ; } public void visitLibModule ( LibModule module ) { for ( Id id : module . c o n t e x t _ l i s t ( ) . g e t L i s t ( ) ) { id . accept ( this ) ; } module . schemedef ( ) . accept ( this ) ; } public void visitSchemeDef ( SchemeDef scheme ) { scheme . id ( ) . accept ( this ) ; scheme . class_expr ( ) . accept ( this ) ; } public void v i s i t B a s i c C l a s s E x p r ( BasicClassExpr basicClassExpr ) { for ( Decl d e c l : basicClassExpr . d e c l a r a t i o n _ l i s t ( ) . g e t L i s t ( ) ) { d e c l . accept ( this ) ; } } 514

F.2. VISITOR MODULES public void visitExtendingClassExpr ( ExtendingClassExpr extendingClassExpr ) { extendingClassExpr . base_class ( ) . accept ( this ) ; extendingClassExpr . e x t e n s i o n _ c l a s s ( ) . accept ( this ) ; } public void v i s i t S c h e m e I n s t a n t i a t i o n ( SchemeInstantiation s c h e m e I n s t a n t i a t i o n ) { s c h e m e I n s t a n t i a t i o n . id ( ) . accept ( this ) ; } /∗Type D e c l a r a t i o n s ∗/ public void visitTypeDecl ( TypeDecl typeDecl ) { for ( TypeDef typeDef : typeDecl . type_def_list ( ) . g e t L i s t ( ) ) { typeDef . accept ( this ) ; } } public void v i s i t S o r t D e f ( SortDef s o r t D e f ) { s o r t D e f . sd_id ( ) . accept ( this ) ; } public void v i s i t V a r i a n t D e f ( VariantDef variantDef ) { variantDef . id ( ) . accept ( this ) ; for ( Variant v a r i a n t : variantDef . v a r i a n t _ l i s t ( ) . g e t L i s t ( ) ) { v a r i a n t . accept ( this ) ; } } public void v i s i t U n i o n D e f ( UnionDef unionDef ) { unionDef . ud_id ( ) . accept ( this ) ; for ( NameOrWildcard nameOrWildcard : unionDef . name_or_wildcard_list ( ) . g e t L i s t ( ) ) { nameOrWildcard . accept ( this ) ; } } public void v i s i t S h o r t R e c o r d D e f ( ShortRecordDef shortRecordDef ) { shortRecordDef . srd_id ( ) . accept ( this ) ; for ( ComponentKind componentKind : shortRecordDef . component_kind_string ( ) . g e t L i s t ( ) ) { componentKind . accept ( this ) ; } } public void v i s i t A b b r e v i a t i o n D e f ( AbbreviationDef abbreviationDef ) { abbreviationDef . abbr_id ( ) . accept ( this ) ; abbreviationDef . type_expr ( ) . accept ( this ) ; } 515

F.2. VISITOR MODULES<br />

public void visitExtendingClassExpr ( ExtendingClassExpr<br />

extendingClassExpr ) {<br />

extendingClassExpr . base_class ( ) . accept ( this ) ;<br />

extendingClassExpr . e x t e n s i o n _ c l a s s ( ) . accept ( this ) ;<br />

}<br />

public void v i s i t S c h e m e I n s t a n t i a t i o n ( SchemeInstantiation<br />

s c h e m e I n s t a n t i a t i o n ) {<br />

s c h e m e I n s t a n t i a t i o n . id ( ) . accept ( this ) ;<br />

}<br />

/∗Type D e c l a r a t i o n s ∗/<br />

public void visitTypeDecl ( TypeDecl typeDecl ) {<br />

for ( TypeDef typeDef : typeDecl . type_def_list ( ) . g e t L i s t ( ) ) {<br />

typeDef . accept ( this ) ;<br />

}<br />

}<br />

public void v i s i t S o r t D e f ( SortDef s o r t D e f ) {<br />

s o r t D e f . sd_id ( ) . accept ( this ) ;<br />

}<br />

public void v i s i t V a r i a n t D e f ( VariantDef variantDef ) {<br />

variantDef . id ( ) . accept ( this ) ;<br />

for ( Variant v a r i a n t : variantDef . v a r i a n t _ l i s t ( ) . g e t L i s t ( ) ) {<br />

v a r i a n t . accept ( this ) ;<br />

}<br />

}<br />

public void v i s i t U n i o n D e f ( UnionDef unionDef ) {<br />

unionDef . ud_id ( ) . accept ( this ) ;<br />

for ( NameOrWildcard nameOrWildcard :<br />

unionDef . name_or_wildcard_list ( ) . g e t L i s t ( ) ) {<br />

nameOrWildcard . accept ( this ) ;<br />

}<br />

}<br />

public void v i s i t S h o r t R e c o r d D e f ( ShortRecordDef shortRecordDef ) {<br />

shortRecordDef . srd_id ( ) . accept ( this ) ;<br />

for ( ComponentKind componentKind :<br />

shortRecordDef . component_kind_string ( ) . g e t L i s t ( ) ) {<br />

componentKind . accept ( this ) ;<br />

}<br />

}<br />

public void v i s i t A b b r e v i a t i o n D e f ( AbbreviationDef abbreviationDef ) {<br />

abbreviationDef . abbr_id ( ) . accept ( this ) ;<br />

abbreviationDef . type_expr ( ) . accept ( this ) ;<br />

}<br />

515

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

Saved successfully!

Ooh no, something went wrong!