Transformation of Applicative Specifications into Imperative ...

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

26.09.2013 Views

APPENDIX E. ANTLR GRAMMAR ; } else { ocond = new NoPreCondition ( ) ; ocond = new PreCondition ( cond ) ; } } { efd = new E x p l i c i t F u n c t i o n D e f ( st , ia , ve , ocond ) ; } i d _ a p p l i c a t i o n returns [ I d A p p l i c a t i o n i a ] { i a = null ; Id i d e n t i f i e r = null ; FormalFunctionParameter f f p = null ; } : i d e n t i f i e r = id LPAREN f f p = formal_function_parameter RPAREN { i a = new I d A p p l i c a t i o n ( i d e n t i f i e r , f f p ) ; } ; formal_function_parameter returns [ FormalFunctionParameter f f p ] { f f p = null ; RSLListDefault b i n d i n g _ l i s t = new RSLListDefault() ; Binding b = null ; } : ( b = binding { b i n d i n g _ l i s t . g e t L i s t ( ) . add ( b ) ; } ( COMMA b = binding { b i n d i n g _ l i s t . g e t L i s t ( ) . add ( b ) ; } ) ∗ ) ? { f f p = new FormalFunctionParameter ( b i n d i n g _ l i s t ) ; } ; single_typing returns [ SingleTyping s t ] { s t = null ; Binding b = null ; TypeExpr te = null ; } : b = binding COLON te = type_expr { s t = new SingleTyping (b , te ) ; } ; typing returns [ Typing t ] { t = null ; Binding b = null ; RSLListDefault b i n d i n g _ l i s t = 484

} : ; TypeExpr te = null ; new RSLListDefault() ; b = binding ( COLON te = type_expr { t = new Make_SingleTyping ( new SingleTyping (b , te ) ) ; } | COMMA { b i n d i n g _ l i s t . g e t L i s t ( ) . add ( b ) ; } b = binding { b i n d i n g _ l i s t . g e t L i s t ( ) . add ( b ) ; } ( COMMA b = binding { b i n d i n g _ l i s t . g e t L i s t ( ) . add ( b ) ; } ) ∗ COLON te = type_expr { t = new Make_MultipleTyping ( new MultipleTyping ( b i n d i n g _ l i s t , te ) ) ; } ) binding returns [ Binding b ] { b = null ; Binding b1 = null ; Id i d e n t i f i e r = null ; RSLListDefault b i n d i n g _ l i s t = new RSLListDefault() ; } : ( b1 = s i n g l e _ b i n d i n g {b = b1 ; } | b1 = prod_binding {b = b1 ; } ) ; s i n g l e _ b i n d i n g returns [ Binding b ] { b = null ; Id i d e n t i f i e r = null ; } : i d e n t i f i e r = id {b = new IdBinding ( i d e n t i f i e r ) ; } ; 485

APPENDIX E. ANTLR GRAMMAR<br />

;<br />

}<br />

else {<br />

ocond = new NoPreCondition ( ) ;<br />

ocond = new PreCondition ( cond ) ; }<br />

}<br />

{ efd = new E x p l i c i t F u n c t i o n D e f ( st , ia , ve , ocond ) ; }<br />

i d _ a p p l i c a t i o n returns [ I d A p p l i c a t i o n i a ] {<br />

i a = null ;<br />

Id i d e n t i f i e r = null ;<br />

FormalFunctionParameter f f p = null ;<br />

}<br />

: i d e n t i f i e r = id LPAREN<br />

f f p = formal_function_parameter<br />

RPAREN<br />

{ i a = new I d A p p l i c a t i o n ( i d e n t i f i e r , f f p ) ; }<br />

;<br />

formal_function_parameter returns [ FormalFunctionParameter f f p ] {<br />

f f p = null ;<br />

RSLListDefault b i n d i n g _ l i s t =<br />

new RSLListDefault() ;<br />

Binding b = null ;<br />

}<br />

: (<br />

b = binding<br />

{ b i n d i n g _ l i s t . g e t L i s t ( ) . add ( b ) ; }<br />

(<br />

COMMA b = binding<br />

{ b i n d i n g _ l i s t . g e t L i s t ( ) . add ( b ) ; }<br />

) ∗<br />

) ?<br />

{ f f p = new FormalFunctionParameter ( b i n d i n g _ l i s t ) ; }<br />

;<br />

single_typing returns [ SingleTyping s t ] {<br />

s t = null ;<br />

Binding b = null ;<br />

TypeExpr te = null ;<br />

}<br />

: b = binding COLON te = type_expr<br />

{ s t = new SingleTyping (b , te ) ; }<br />

;<br />

typing returns [ Typing t ] {<br />

t = null ;<br />

Binding b = null ;<br />

RSLListDefault b i n d i n g _ l i s t =<br />

484

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

Saved successfully!

Ooh no, something went wrong!