Differences

This shows you the differences between two versions of the page.

Link to this comparison view

research:jtransformer:api:java:pefs:3.0:newarrayt [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
 +----
 +
 +=== newArrayT (#id, #parent, #encl, [#​dim_1,​...],​ [#​elem_1,​...],​ #​type) ​ ===
 +== ==
 +
 +Represents the array creation expression.\\ ​
 +Optionally marked with an [[omitarraydeclarationt|omitArrayDeclarationT]].
 +
 +=== 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]],​ [[classt|classT]],​ [[annotationMemberT|annotationMemberT]],​ [[annotationT|annotationT]]\\ ​
 +ID of the fact that represents the enclosing element.
 +
 +**[#​dim_1,​...]:​** [[plastexpression|expression]]\\ ​
 +list of dimension expressions.
 +
 +**[#​elem_1,​...]:​** [[plastexpression|expression]],​ [[annotationExpressionType|annotationExpressionType]]\\ ​
 +list of initial elements of this array.
 +
 +**#type:** [[typeinst]]\\
 +the id of the type of this array.
 + 
 +=== Sample Java Code ===
 +==  ==
 +<Code lang-java>​
 +void myArrayAcces(){
 + int[] array = {1, 3, 8};//​corresponding code line to newArrayt
 + array[0]= 9;
 +}
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +==  ==
 +<Code lang-prolog>​
 +methodDefT(#​encl,​ ..., '​myArrayAcces',​ [], #​returntype,​ [], ...).
 +localDefT(#​parent,​ ..., #encl, type(basic, int, 1), '​array',​ #id).
 +newArrayT(#​id,​ #parent, #encl, [], [#elem_1, #elem_2, #elem_3], #​newarraytype).
 +omitArrayDeclarationT(#​id).
 +literalT(#​elem_1,​ #id, #encl, #​literal1type,​ '​1'​).
 +literalT(#​elem_2,​ #id, #encl, #​literal2type,​ '​3'​).
 +literalT(#​elem_3,​ #id, #encl, #​literal3type,​ '​8'​).
 +</​Code>​
 +
 +=== AST Specification ===
 +== ==
 +<​Code>​
 +ast_node_def('​Java',​newArrayT,​[
 +     ​ast_arg(id, ​     mult(1,1,no ), id,  [newArrayT]),​ % <-- convention!!!
 +     ​ast_arg(parent, ​ mult(1,1,no ), id,  [id]), % <-- convention!!!
 +     ​ast_arg(encl, ​   mult(1,1,no ), id,  [methodT, constructorT,​ classInitializerT,​ fieldT, classT, annotationMemberT,​ annotationT]),​
 +     ​ast_arg(dims, ​   mult(1,​*,​ord),​ id,  [expressionType]),​
 +     ​ast_arg(elems, ​  ​mult(0,​*,​ord),​ id,  [expressionType,​annotationExpressionType]),​
 +     ​ast_arg(type, ​   mult(1,1,no ), it,  [typeInst])
 +]).
 +</​Code>​
 +
  
research/jtransformer/api/java/pefs/3.0/newarrayt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019