Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
research:jtransformer:api:java:pefs:3.0:fort [2013/07/03 05:06]
127.0.0.1 external edit
research:jtransformer:api:java:pefs:3.0:fort [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
 +
 +----
 +
 +=== forT (#id, #parent, #encl, [#​init_1,​...],​ #condition, [#​step_1,​...],​ #​body) ​ ===
 +
 +
 +Represents the for statement.
 +
 +Formerly called forLoopT: Renamed since JTransformer 2.3.1_200804151649.
 +
 +=== Attributes==
 +== ==
 +**#id:** id\\ 
 +the unique ID assigned to this fact.
 +
 +**#​parent:​** id\\ 
 +ID of the parent node.
 +
 +**#encl:** [[methodT|methodT]],​ [[constructorT|constructorT]],​ [[classInitializerT|classInitializerT]]\\ ​
 +ID of the enclosing element.
 +
 +**[#​init_1,​...]:​** [[plastexpression|expression]],​ [[localt|localT]]\\ ​
 +list of IDs of the initializer expressions in this for statement.
 +
 +**#​condition:​** [[plastexpression|expression]],​ null\\ ​
 +ID of the expression in this for statement.
 +
 +**[#​step_1,​...]:​** [[plastexpression|expression]]\\ ​
 +list of IDs of the update expressions in this for statement.
 +
 +**#body:** [[plaststatement|statement]]\\ ​
 +ID of the body of this for statement.
 +
 +
 +=== Sample Java Source ===
 +==  ==
 +<Code lang-java>​
 +void myFor(){
 + int j = 0;
 + for (int i = 0; i < 10;i ++){ // corresponding code line to forT
 + j++;
 + }
 +}
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +==  ==
 +<Code lang-prolog>​
 +methodT(#​Method,​ _, '​myFor',​ [], type(basic, void, 0), [], #Block),
 +blockT(#​Block,​ #Method, #Method, [_, #For]),
 +...
 +forT(#For, #Block, #Method, [#Local], #​OperationT,​ [#​OperationT2],​ #​Block2), ​ % for
 +localT(#​Local,​ #For, #Method, type(basic, int, 0), '​i',​ ..),           %j = 0
 +...
 +operationT(#​OperationT,​ #For, #Method, [..], '<',​ 0),                        % i<10
 +...
 +operationT(#​OperationT2,​ #For, #Method, [..], '​++',​ 1),                      %i++
 +...
 +blockT(#​Block2,​ #For, #Method, [..]),
 +</​Code>​
 +
 +=== AST Specification===
 +== ==
 +<​Code>​
 +ast_node_def('​Java',​forT,​[
 +     ​ast_arg(id, ​     mult(1,1,no ), id,  [forT]), % <-- convention!!!
 +     ​ast_arg(parent, ​ mult(1,1,no ), id,  [id]), % <-- convention!!!
 +     ​ast_arg(encl, ​   mult(1,1,no ), id,  [methodT, constructorT,​ classInitializerT]),​
 +     ​ast_arg(inits, ​  ​mult(0,​*,​ord),​ id,  [expressionType,​localT]),​
 +     ​ast_arg(cond, ​   mult(0,​1,​no),​ id,   ​[expressionType,​nullType]),​
 +     ​ast_arg(updaters,​mult(0,​*,​ord),​ id,  [expressionType]),​
 +     ​ast_arg(body, ​   mult(1,1,no ), id,  [statementType])
 +]).
 +</​Code>​
 + 
  
research/jtransformer/api/java/pefs/3.0/fort.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019