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

research:jtransformer:api:java:pefs:2.9:ift [2018/05/09 01:59]
research:jtransformer:api:java:pefs:2.9:ift [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
 +----
 +
 +=== ifT (#id, #parent, #encl, #condition, #thenPart, #​elsePart) ​ ===
 +
 +Represents the if statement.
 + 
 +=== Arguments ===
 +== ==
 +**#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.
 + 
 +**#​condition:​** [[plastexpression|expression]]\\ ​
 +ID of the expression in this if statement.
 +
 +**#​thenPart:​** [[plaststatement|statement]]\\ ​
 +ID of the "​then"​ part of this if statement.
 +
 +**#​elsePart:​** [[plaststatement|statement]],​ null\\ ​
 +ID of the "​else"​ part of this if statement, or '​null'​ if this if statement has no "​else"​ part.
 + 
 +=== Sample Java Code ===
 +==  ==
 +<Code lang-java>​
 +void myIf(){
 + int i =0;
 + if (i > 0)//​corresponding code line to ifT
 + i++;
 +}
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +==  ==
 +<Code lang-prolog>​
 +methodT(#​enclMethod,​ ..., '​myIf',​ [], type(basic, void, 0), [], #parent).
 +blockT(#​parent,​ #​enclMethod,​ #​enclMethod,​ [..., #id]).
 +ifT(#id, #parent, #​enclMethod,​ #condition, #thenPart, '​null'​).
 +
 +operationT(#​condition,​ #id, #​enclMethod,​ [..., ...], '>',​ 0).
 +execT(#​thenPart,​ #id, #​enclMethod,​ ...).
 +</​Code>​
 +
 +=== AST Specification ===
 +== ==
 +<​Code>​
 +ast_node_def('​Java',​ifT,​[
 +     ​ast_arg(id, ​     mult(1,1,no ), id,  [ifT]), % <-- convention!!!
 +     ​ast_arg(parent, ​ mult(1,1,no ), id,  [id]), % <-- convention!!!
 +     ​ast_arg(encl, ​   mult(1,1,no ), id,  [methodT, constructorT,​ classInitializerT]),​
 +     ​ast_arg(cond, ​   mult(1,1,no ), id,  [expressionType]),​
 +     ​ast_arg(then, ​   mult(1,1,no ), id,  [blockT,​statementType]),​
 +     ​ast_arg(else, ​   mult(0,​1,​no),​ id,   ​[nullType,​blockT,​statementType])
 +]).
 +</​Code> ​
  
research/jtransformer/api/java/pefs/2.9/ift.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019