-- @name Expand -- @version 1.0 -- @project members Robert Tairas, Alex Liu -- @date created 2007/04/13 -- @description This metamodel defines the abstract syntax of a subset of Java. package Expand { -- Every class must extend LocatedElement, directly or indirectly. -- This is a technical constraint added by the current -- version of TCS. abstract class LocatedElement { attribute location : String; attribute commentsBefore[*] ordered : String; attribute commentsAfter[*] ordered : String; } -- @begin Root class Root extends LocatedElement { reference statements[*] ordered container : Statement; } -- @end Root -- @begin Statements abstract class Statement extends LocatedElement {} class AssignStat extends Statement { reference variable container : Variable; reference initExp container : Expression; } class BoxStat extends LocatedElement { reference statements[*] ordered container : Statement; } class DeclarationStat extends Statement { attribute type : Type; reference variable container : Variable; reference initExp container : Expression; } class FunctionStat extends Statement { attribute modifier : Modifier; attribute returnType : Type; reference name container: Variable; reference parameters[*] ordered container : Parameter; reference statements[*] ordered container : Statement; } class ReturnStat extends Statement { reference variable container : Variable; } class Parameter extends LocatedElement { attribute type : Type; reference variable container : Variable; } -- @end Statements -- @begin Variables abstract class Variable extends LocatedElement { attribute varName : String; } class ActualVar extends Variable { } -- @end Variables -- @begin Expressions abstract class Expression extends LocatedElement {} class IntegerExp extends Expression { attribute value : Integer; } class VariableExp extends Expression { reference value container : Variable; } abstract class OperatorCallExp extends Expression { attribute opName : String; } class BinaryOperatorCallExp extends OperatorCallExp { reference left container : Expression; reference right container : Expression; } class UnaryOperatorCallExp extends OperatorCallExp { reference operand container : Expression; } -- @end Expressions } package Enum { enumeration Type { literal INT; } enumeration Modifier { literal PUBLIC; } } package PrimitiveTypes { datatype Boolean; datatype Integer; datatype String; }