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

User Tools

Site Tools


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:meta:meta-model:ast_relation [2011/02/15 15:29]
Günter Kniesel
research:jtransformer:api:meta:meta-model:ast_relation [2018/05/09 01:59] (current)
Line 1: Line 1:
 + -> [[..:​..:​notation|Notation used in the following]]
 +**ast_relation**(?​Language,​ ?​AstRelLabel : atom, ?​AstNodeArguments : list)  is nondet
 +  * The nodes in the Abstract Syntax Tree (AST) for the language arg1 are linked by relations with
 +    type (label / functor) arg2 and arguments conforming to the [[argument descriptors]] in arg3.
 +    //Relations do not have own identities//​. This is what distinguishes them from AST nodes. ​
 +    All identities occuring as arguments in a relation fact are references to other facts, which represent AST  nodes. ​
 +    Example (excerpt from Java AST definition):​
 +<​Code> ​  ​ast_relation('​Java',​extendsT,​[
 +     ​ast_arg(sub, ​  ​mult(1,​1,​no ), id,   ​[classT]),​
 +     ​ast_arg(super,​ mult(1,1,no ), id,   ​[classT])
 +   ]).
 +  * Relations can degenerate to simple attributes. Then they take the form of binary predicates with 
 +    one argument being the id of some AST node and the other argument being the attribute value 
 +    attached to that node. This makes sense if such arguments can be optional or multi-valued but unordered ​
 +    (Ordered multi-valued arguments are represented as lists). For instance, in the Java AST definition ''​modifierT''​
 +    adds various modifiers to elements such as classes, methods and fields:
 +<​Code> ​  ​ast_relation('​Java',​modifierT,​[
 +     ​ast_arg(id, ​      ​mult(1,​1,​no ), id,   ​[classT,​ fieldT, methodT, constructorT,​ classInitializerT]),​
 +     ​ast_arg(modifier,​ mult(1,1,no ), attr, [atom])
 +   ]).
 +  * Relations can further degenerate to flags. Then they take the form of unary predicate with 
 +    one single argument being the id of some AST node. For instance, in the Java AST definition ​
 +    ''​externT''​ marks classes available only as byte-code:
 +<​Code> ​   ast_relation('​Java',​externT,​[
 +     ​ast_arg(id, ​    ​mult(1,​1,​no ), id,   ​[classT])
 +   ]).
research/jtransformer/api/meta/meta-model/ast_relation.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019