SDA SE Wiki

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

User Tools

Site Tools



precedenceT(#id, #parent, #encl, #expr)

Represents an expression in parentheses () in the source code.

Arguments

#id: id
the unique ID given to this node.

#parent: id
ID if the parent node in the AST.

#encl: methodT, constructorT, classInitializerT, fieldT
ID of the fact that represents the enclosing element.

#expr: expression
ID of the expression within the parenthesis.

Sample Java Code

...
int i = (4 + 8) * 2;    // (4 + 8) is our precedenceT
...

Its PEF Representation

localT(#Local, #Parent, #Enclosing, type(basic, int, 0), 'i', #OuterOperation).
 operationT(#OuterOperation, #Local, #Enclosing, [#Precedence, #Literal_15], *, 0).
   precedenceT(#Precedence, #OuterOperation, #Enclosing, #InnerOperation).
     operationT(#InnerOperation, #Precedence, #Enclosing, [#Literal_4, #Literal_8], +, 0).
     literalT(#Literal_4, #InnerOperation, #Enclosing, type(basic, int, 0), '4').
     literalT(#Literal_8, #InnerOperation, #Enclosing, type(basic, int, 0), '8').
   literalT(#Literal_15, #OuterOperation, #Enclosing, type(basic, int, 0), '15').

AST Specification

ast_node_def('Java',precedenceT,[
     ast_arg(id,     mult(1,1,no ), id,  [precedenceT]), % <-- 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(expr,   mult(1,1,no ), id,  [expressionType])
]).
research/jtransformer/api/java/pefs/3.0/precedencet.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2018