In article 
<[email protected]>,
 [email protected] wrote:

> I am using the Topcased plugin to generate a state machine having states and 
> transitions . I have a question regarding the representation of a guard 
> expression, which is a Boolean expression of the general form :  label = (A1 
> rop1 B1) bop1 (A2 rop2 B2)....
> 
> The above code uses the label as a string. I would like to store the 
> expression as an expression tree  (left operand, operator, right operand). 
> There appears to be an Expression class but I am not how that can be used to 
> generate an expression tree for the guard. Is there a class that can create 
> an expression  tree  from a string or allow me to create the tree and 
> associate  it with guard? Some code example would be helpful.

If you want an object tree, then first you would have to define the 
metamodel of your expression language (basically the Abstract Syntax 
Tree, AST) in a profile. Then you could stereotype the guard, and add a 
field of type AST (or rather, the root element thereof). You could then 
create such a tree programmatically (after running the EMF codegen) or 
through the reflexive EMF editor.

If you really are going to work with those labels, you probably want a 
parser (and unparser) as well. In that case, defining the AST as a tree 
does not buy you much, since you have the parsing/unparsing anyway and 
could quickly apply it on the label.

Volker

-- 
United Nations University -                       http://rcos.iist.unu.edu/~vs/
International Institute for Software Technology   Macau SAR, China


_______________________________________________
Topcased-users mailing list
[email protected]
http://lists.gforge.enseeiht.fr/mailman/listinfo/topcased-users

Reply via email to