SDA SE Wiki

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

User Tools

Site Tools


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):
   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:
   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:
    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