SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
research:jtransformer:api:java:pefs:4.0:foreacht [2015/04/28 12:49]
127.0.0.1 external edit
research:jtransformer:api:java:pefs:4.0:foreacht [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
  
 +----
 +
 +=== foreachT (#id, #parent, #encl, #param, #​expression, ​ #​body) ​ ===
 +++ Java 5 Syntax Element | - supported since JTransformer 2.3.  ++
 +
 +Represents the for each statement.
 +
 +=== 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.
 +
 +**#param,** [[paramt|paramT]]\\ ​
 +ID of the local parameter of this for statement.
 +
 +**#​expression** [[plastexpression|expression]]\\
 +ID of the expression (of type list or array) in this for statement.
 +
 +**#body:** [[plaststatement|statement]]\\ ​
 +ID of the body of this for statement.
 + 
 +
 +=== Sample Java Source ===
 +==  ==
 +<Code lang-java>​
 +int[] array = {1, 2, 3};
 +for (int i : array) {
 +  ...
 +}
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +==  ==
 +<Code lang-prolog>​
 +localT(#​Array,​ #Block, #Method, type(basic, int, 1), array, #NewArray)
 +foreachT(#​ForEach,​ #Block, #Method, #Param, #Ident, #BlockFor),
 +paramT(#​Param,​ #ForEach, type(basic, int, 0), '​d'​),​
 +identT(#​Ident,​ #ForEach, #Method, '​array',​ #Array),
 +blockT(#​BlockFor,​ #ForEach, #Method, [...]),
 +...
 +</​Code>​
 +
 +=== AST Specification===
 +== ==
 +<​Code>​
 +ast_node_type_spec(foreachT,​ [
 +     ​ast_arg(id, ​    ​mult(1,​1,​no ), id,  [foreachT]),​
 +     ​ast_arg(parent,​ mult(1,1,no ), id,  [id]),
 +     ​ast_arg(encl, ​  ​mult(1,​1,​no ), id,  [methodT, constructorT,​ classInitializerT]),​
 +     ​ast_arg(inits, ​ mult(1,1,no ), id,  [paramT]),
 +     ​ast_arg(expr, ​  ​mult(1,​1,​no ), id,  [expressionType]),​
 +     ​ast_arg(body, ​  ​mult(1,​1,​no ), id,  [blockT, statementType])
 +]).
 +</​Code>​
research/jtransformer/api/java/pefs/4.0/foreacht.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019