Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfjouault2013-12-18 17:23:55 +0000
committerfjouault2013-12-18 17:23:55 +0000
commit65b0671d4f5d0907029e1974c39e5dad4ffad691 (patch)
tree0de5dbf66d69f19c467de658fbb468031a3e5ec3 /syntaxes/Program/Metamodel
downloadorg.eclipse.atl.tcs-65b0671d4f5d0907029e1974c39e5dad4ffad691.tar.gz
org.eclipse.atl.tcs-65b0671d4f5d0907029e1974c39e5dad4ffad691.tar.xz
org.eclipse.atl.tcs-65b0671d4f5d0907029e1974c39e5dad4ffad691.zip
initial commit of approved contribution (see bug 417707)
This version needs refactoring (notably package names) as well as porting to current version of ATL
Diffstat (limited to 'syntaxes/Program/Metamodel')
-rw-r--r--syntaxes/Program/Metamodel/Program.ann2
-rw-r--r--syntaxes/Program/Metamodel/Program.km3134
2 files changed, 136 insertions, 0 deletions
diff --git a/syntaxes/Program/Metamodel/Program.ann b/syntaxes/Program/Metamodel/Program.ann
new file mode 100644
index 0000000..1c651e6
--- /dev/null
+++ b/syntaxes/Program/Metamodel/Program.ann
@@ -0,0 +1,2 @@
+annotate Program {
+} \ No newline at end of file
diff --git a/syntaxes/Program/Metamodel/Program.km3 b/syntaxes/Program/Metamodel/Program.km3
new file mode 100644
index 0000000..650c329
--- /dev/null
+++ b/syntaxes/Program/Metamodel/Program.km3
@@ -0,0 +1,134 @@
+-- @name Program
+-- @version 0.1
+-- @domains programming
+-- @authors Frédéric Jouault
+-- @date 2007/03/07
+-- @description This metamodel describes programs. A Program inherits both from Structure and ProcContainerElement. A Progam can contain VariableDeclarations (as a Structure), Procedures (as a ProcContainerElement), and Monitors. A Monitor is also a Structure and a ProcContainerElement, and can therefore contain VariableDeclarations and Procedures. Besides Statements and Parameters, a Procedure, as a Structure, can also contain VariableDeclarations. Each VariableDeclaration is associated with a one and only Type. It may also contain an initial value that is represented by an Expression (see below). Parameters inherit from VariableDeclaration. They are characterized by a "direction" attribute ("in" or "out"). A Procedure contains a sequence of Statements. An AssignmentStat contains a "target" VariableExp and a "value" Expression. A WhileStat contains a "condition" Expression and several "doStats" Statements. A ConditionalStat contains a "condition" Expression, several "thenStats" Statements and, optionally, "elseStats" Statements. Finally, an ExpressionStat simply contains an Expression. Expression is an abstract entity from which the following elements inherit: IntegerExp and BooleanExp (which inherit from the abstract LiteralExp entity), VariableExp which is associated with a VariableDeclaration, PropertyCallExp (abstract) which is characterized by its "source" element (of type Expression). There exist three types of PropertyCallExp: the AttributeCallExp, the OperatorCallExp and the ProcedureCallExp. An OperatorCallExp contains a right element (of type Expression). A ProcedureCallExp can contain "argument" Expressions.
+package Program {
+
+ abstract class LocatedElement {
+ attribute location[0-1] : String;
+ attribute commentsBefore[*] ordered : String;
+ attribute commentsAfter[*] ordered : String;
+ }
+
+ abstract class NamedElement extends LocatedElement {
+ attribute name : String;
+ }
+
+ abstract class Structure extends NamedElement {
+ reference variables[*] ordered container : VariableDeclaration oppositeOf structure;
+ }
+
+ abstract class ProcContainerElement extends Structure {
+ reference procedures[*] ordered container : Procedure oppositeOf "container";
+ }
+
+ class Program extends ProcContainerElement {
+ reference monitors[*] ordered container : Monitor oppositeOf program;
+ }
+
+ class Monitor extends ProcContainerElement {
+ reference program : Program oppositeOf monitors;
+ }
+
+ -- Procedures
+ class Procedure extends Structure {
+ reference "container" : ProcContainerElement oppositeOf procedures;
+ reference parameters[*] ordered container : Parameter oppositeOf procedure;
+ reference statements[*] ordered container : Statement;
+ }
+
+ class VariableDeclaration extends NamedElement {
+ reference type : Type;
+ reference initialValue[0-1] container : Expression;
+ reference structure : Structure oppositeOf variables;
+ }
+
+ class Parameter extends VariableDeclaration {
+ attribute direction : Direction;
+ reference procedure : Procedure oppositeOf parameters;
+ }
+
+ enumeration Direction {
+ literal in;
+ literal out;
+ }
+ -- End Procedures
+
+ -- Types
+ class Type extends NamedElement {
+ }
+ -- End Types
+
+ -- Expressions
+ abstract class Expression extends LocatedElement {
+ }
+
+ class VariableExp extends Expression {
+ reference declaration : VariableDeclaration;
+ }
+
+ -- PropertyCalls
+ abstract class PropertyCallExp extends Expression {
+ reference source container : Expression;
+ attribute name : String;
+ }
+
+ class OperatorCallExp extends PropertyCallExp {
+ reference right container : Expression;
+ }
+
+ class AttributeCallExp extends PropertyCallExp {
+ }
+
+ class ProcedureCallExp extends PropertyCallExp {
+ reference arguments[*] ordered container : Expression;
+ }
+ -- End PropertyCalls
+
+ -- Literals
+ abstract class LiteralExp extends Expression {
+ }
+
+ class BooleanExp extends LiteralExp {
+ attribute symbol : Boolean;
+ }
+
+ class IntegerExp extends LiteralExp {
+ attribute symbol : Integer;
+ }
+ -- End Literals
+ -- End Expressions
+
+ -- Statements
+ abstract class Statement extends LocatedElement {
+ }
+
+ class AssignmentStat extends Statement {
+ reference target container : VariableExp;
+ reference value container : Expression;
+ }
+
+ class ConditionalStat extends Statement {
+ reference condition container : Expression;
+ reference thenStats[1-*] container : Statement;
+ reference elseStats[*] container : Statement;
+ }
+
+ class WhileStat extends Statement {
+ reference condition container : Expression;
+ reference doStats[1-*] container : Statement;
+ }
+
+ class ExpressionStat extends Statement {
+ reference expression container : Expression;
+ }
+ -- End Statements
+}
+
+package PrimitiveTypes {
+ datatype Boolean;
+ datatype Integer;
+ datatype String;
+}

Back to the top