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.2:lambdat [2017/08/29 17:09]
127.0.0.1 external edit
research:jtransformer:api:java:pefs:4.2:lambdat [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
  
 +----
 +
 +=== lambdaT(#​id,​ #parent, #encl, [#​param_1,​...],​ #​body) ​ ===
 +
 +Represents a lambda expression. ​ See the [[http://​docs.oracle.com/​javase/​specs/​jls/​se8/​html/​jls-15.html#​jls-15.27|Java Language Specification]]. This PEF has two optional flags: [[omit_lambdaparameterparenthesest|omit_lambdaParameterParenthesesT]] and [[omit_lambdaparametertypest|omit_lambdaParameterTypesT]] used for preserving syntactic suggar when regenerating source code after transformations.
 +
 +=== Arguments ===
 +
 +==  ==
 +**#id:** id\\  ​
 +the unique ID assigned to this fact.
 +
 +**#​parent:​** id\\ 
 +the ID of the fact that represents the parent of this fact in the prolog AST.
 +
 +**#encl:** [[method_declaration_type|Method declaration type]], [[fieldt|fieldT]]\\ ​
 +the ID of the fact that represents the enclosing element.
 +
 +**[#​param_1,​...]:​** [[paramt|paramT]]\\ ​
 +list of this lambda expression'​s parameters
 +
 +**#body:** [[plastexpression|expression]],​ [[blockt|blockT]] \\
 +ID of the expression or block element for this lambda expression
 +
 +=== Sample Java Source ===
 +
 +==  ==
 +
 +<Code lang-java>​
 +JButton button = new JButton();
 +button.addActionListener((ActionEvent e) -> System.out.println("​button pressed"​));​
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +
 +==  ==
 +<​Code>​
 +localT(#​Button,​ ..., '​button',​ ...).
 +...
 +callT(#​Parent,​ ..., [#Lambda], #​RefToAddActionListener,​ [], ...).
 +lambdaT(#​Lambda,​ #Parent, #Enclosing, [#​Parameter],​ #Body).
 +paramT(#​Parameter,​ #Lambda, #​RefToActionEvent '​e'​). ​            // Paramter of the lambda expression
 +callT(#​Body,​ #Lambda, #Lambda, ...).                            // Sysout call (Body of the lambda expression)
 +</​Code>​
 +
 +=== AST Specification ===
 +== ==
 +<​Code>​
 +ast_node_type_spec(lambdaT,​[
 + ast_arg(id,​ mult(1,1,no ), id, [lambdaT]),
 + ast_arg(parent, ​ mult(1,1,no ), id, [id]),
 + ast_arg(encl, ​   mult(1,1,no ), id, [method_declaration_type,​ fieldT]),
 + ast_arg(params, ​ mult(0,​*,​ord),​ id, [paramT]),
 + ast_arg(body, ​   mult(1,​1,​no), ​ id, [blockT, expressionType])
 +]). 
 +</​Code>​
research/jtransformer/api/java/pefs/4.2/lambdat.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019