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:3.0:identt [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
  
 +----
 +
 +=== identT(#id, #parent, #encl, '​name',​ #​symbol) ​ ===
 +
 +Represents an access to
 +  - a simple name (local variable or parameter) or
 +  - '​this'​ or
 +  - '​super'​ or
 +  - '​null'​.
 +
 +//in JTransformer versions < 2.6.0 identT also represented class literals, and qualified type names. Class literals are now modeled with [[selectT|selectT]] and qualified type names in static method calls and static field accesses with the new PEF [[typeRefT|typeRefT]].//​
 +
 +=== Arguments ===
 +== ==
 +**#id:** id\\ 
 +the unique ID assigned to this fact.
 +
 +**#​parent:​** id\\ 
 +ID of the parent node.
 +
 +**#encl:** [[methodT|methodT]],​ [[constructorT|constructorT]],​ [[classInitializerT|classInitializerT]],​ [[fieldt|fieldT]]\\ ​
 +ID of the fact that represents the method, constructor,​ class initializer or field definition that contains this (pseudo-)variable access.
 +
 +**'​name':​** atom\\ ​
 +'​this',​ '​super',​ '​null'​ or any other legal identifier name
 +
 +**#​symbol:​** '​null',​ [[localt|localT]],​ [[paramt|paramT]],​ [[classt|classT]] \\
 +'​null'​ or ID of the referenced local variable, parameter or class. The access to '​super'​ references as symbol the ID of the superclass, the access to '​this'​ references the ID of 
 +the class of which '​this'​ is an instance. The access to the '​null'​ literal references the symbol ​ '​null':​
 +
 +<Code lang-prolog>​
 + ​identT(...,​ ..., ..., '​nameOfParameter',​ #​idOfParamT). % access to parameter
 + ​identT(...,​ ..., ..., '​nameOfLocalVar', ​ #​idOfLocalT). % access to local var
 + ​identT(...,​ ..., ..., '​super', ​      #​idOfSuperclass). % access to '​super'​
 + ​identT(...,​ ..., ..., '​this', ​         #​idOfOwnClass). % access to '​this'​
 + ​identT(...,​ ..., ..., '​null', ​                '​null'​). % access to '​null'​
 +</​Code>​
 +
 +=== Remark ===
 +
 +Note that identT represents **no field accesses**. Field accesses are represented by [[getFieldT]]. ​
 +
 +==== Sample Java Code ===
 +==  ==
 +<Code lang-java>​
 +public Object m(int i) {
 + int j=0;
 +        ...
 +        x = i + j;
 +        ...
 +        Object o = super.abc;
 +        ...
 +        return this;
 +}
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +For better readability IDs are represented by symbolic constants prefixed with #.
 +==  ==
 +<Code lang-prolog>​
 +methodT(#​encl,​ ..., '​m',​ [], type(basic, void, 0), [], ...).
 +  paramT(#​symbol1,​ ..., type(basic, int, 0), '​i'​).
 +  localT(#​symbol2,​ ..., #encl, type(basic, int, 0), '​j',​ ...).
 +...
 +operationT(#​parent,​ ..., #encl, [#id1, #id2], '​+',​ 0).
 +  identT(#​id1,​ #parent, #encl, '​i',​ #symbol1).
 +  identT(#​id2,​ #parent, #encl, '​j',​ #symbol2).
 +...
 +localT(#​symbol3,​ ..., #encl, type(class,​10001,​0),​ '​o',​ #get).
 +  getFieldT(#​get,​ #symbol3, #encl, #id3, abc, #abc).
 +    identT(#​id3,​ #get, #encl, super, #​superclass).
 +
 +...
 +returnT(#​retid,​ ..., #encl, #ident).
 +  identT(#​ident,​ #retid, #encl, '​this',​ #​classOfThis).
 +</​Code>​
 +
 +=== AST Specification ===
 +== ==
 +<​Code>​
 +ast_node_def('​Java',​identT,​[
 +     ​ast_arg(id, ​     mult(1,1,no ), id,  [identT]),
 +     ​ast_arg(parent, ​ mult(1,1,no ), id,  [id]), ​
 +     ​ast_arg(encl, ​   mult(1,1,no ), id,  [methodT, constructorT,​ classInitializerT,​ fieldT]), ​
 +     ​ast_arg(name, ​   mult(1,1,no ), attr,​[atom]),​
 +     ​ast_arg(ref, ​    ​mult(1,​1,​no ), id,  [classT,​localT,​paramT,​nullType]) ​
 +]).
 +</​Code>​
research/jtransformer/api/java/pefs/3.0/identt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019