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:3.0:indexedt [2014/05/29 12:18]
Günter Kniesel
research:jtransformer:api:java:pefs:3.0:indexedt [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
 +----
  
 +=== indexedT(#​id,​ #parent, #encl, #index, #​arrayRef) ​ ===
 +
 +represents the array access expression.
 +
 +=== Arguments ===
 +
 +__Note__: '//ID of ...//' means '//ID of the fact that represents ...//'​.
 +
 +== ==
 +**#id:** id\\ 
 +ID of this fact.
 +
 +**#​parent:​** id\\ 
 +ID of the parent node.
 +
 +**#​encl:​** ​ [[methodT|methodT]],​ [[constructorT|constructorT]],​ [[classInitializerT|classInitializerT]],​ [[fieldt|fieldt]]\\ ​
 +ID of the method, constructor,​ or initializer((Either class or field initializer)) that contains this array access.
 +
 +**#index:** [[plastexpression|expression]]\\ ​
 +ID of the index expression (Example: In ''​a[i]''​ i is the index expression).
 +
 +**#​arrayRef:​** [[plastexpression|expression]]\\ ​
 +ID of the reference to the accessed array (Example: In ''​a[i]''​ a is the array reference expression).
 +
 +=== Sample Java Code ===
 +==  ==
 +<Code lang-java>​
 +void myArrayAcces(){
 + int[] a = {1, 3, 8};
 + a[0]= 9;     // <-- represented by indexedT fact below
 +}
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +==  ==
 +<Code lang-prolog>​
 +methodT(#​encl,​ ..., '​myArrayAcces',​ [], type(basic, void, 0), [], ...).
 +assignT(#​parent,​ ..., #encl, #id, ...).
 +indexedT(#​id,​ #parent, #encl, #index, #​arrayRef). ​       % <-- a[0]
 +
 +literalT(#​index, ​ #id, #encl, type(basic, int, 0), '​0'​). ​ % <-- 0
 +identT(#​arrayRef,​ #id, #encl, '​a',​ ...).                  % <-- a
 +</​Code>​
 +
 +=== AST Specification ===
 +== ==
 +<​Code>​
 +ast_node_def('​Java',​indexedT,​[
 +     ​ast_arg(id, ​     mult(1,1,no ), id,  [indexedT]),​ % <-- convention!!!
 +     ​ast_arg(parent, ​ mult(1,1,no ), id,  [id]), % <-- convention!!!
 +     ​ast_arg(encl, ​   mult(1,1,no ), id,  [methodT, constructorT,​ classInitializerT,​ fieldT]),
 +     ​ast_arg(index, ​  ​mult(1,​1,​no ), id,  [expressionType]),​
 +     ​ast_arg(array, ​  ​mult(1,​1,​no ), id,  [expressionType])
 +]).
 +</​Code>​
 + 
research/jtransformer/api/java/pefs/3.0/indexedt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019