Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » GMT (Generative Modeling Technologies) » [TCS] Storing operators as enumeration values
[TCS] Storing operators as enumeration values [message #581864] Sat, 05 May 2007 13:43
Lorenzo Dalla Vecchia is currently offline Lorenzo Dalla VecchiaFriend
Messages: 58
Registered: July 2009

My project with TCS is going along very well, using SPL.tcs as reference.

I stumbled upon a minor problem with operation templates: as far as I know,
the storeOpTo option of an operatorTemplate specifies the attribute to save
the parsed operator to. I found that such attribute must be of KM3 type
String for the parser to work, however I originally planned to represent
operations in the KM3 models by means of an enumeration type, to keep the
model high-level.


enumeration Operation {
literal Addition
literal Subtraction

class OperationExpr extends Expr {
reference lExpr : Expr;
reference rExpr : Expr;
attribute operation : Operation;


operatorTemplate OperatorExpr(operators=opPlus opMinus, source=lExpr,

With the above code, the ANTLR parser compiles correctly, but when parsing
an expression, the two Expr objects and an empty OperationExpr are flattened
out at the same level of the tree.

|- Expr
|- Expr
\- Operation {with operation attribute to default value, the first of the

Instead of:

\- Operation
|- Expr
\- Expr

The problem desappears if I set the type of the operation attribute back to
Is there a way to do this with today's TCS?


Previous Topic:Re: [ATL Transfromation] How to create a new class
Next Topic:[TCS] Storing operators as enumeration values
Goto Forum:

Current Time: Sat Apr 21 04:36:47 GMT 2018

Powered by FUDForum. Page generated in 0.02121 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software