| Forum: Epsilon |
|---|
| Topic: Visualising an expression grammar |
|---|
| Re: Visualising an expression grammar [message #1060709 is a reply to message #1059971] |
Tue, 28 May 2013 03:26 |
Claudio Heeg Messages: 57 Registered: April 2013 |
Member |
|
|
Hello,
after a little work I managed to put up the important formulae in tree-form.
I did this by heavily annotating every function, i.e. every parameter of every function got a gmf.link() to show in the tree.
And that, as you might imagine, caused me to run into out-of-heapspace errors and the like and made it impossible to generate diagram code.
As, first of all, the tree view doesn't look all too nice and secondly is costly, I wonder if I could instead put at lease the Parameters of a proper, non-primitive function (i.e. everything except +-*/) into that function's compartment (or as that function's property)?
I did try gmf.compartment(foo="bar") on the parameters, but that didn't seem to work ("Called feature domainMetaElement on undefined object").
A snippet of the grammar look as following:
Function_Simple:
Abs | Cos;
Abs:
name='Abs''('add=Addition')';
Cos:
name='Cos''('add=Addition')';
As you can see those functions can include additions by themselves, so the corresponding Emfatic file snippet looks as follows:
class Expression {
}
@gmf.node(label="name", phantom="true")
class Function_Simple extends Expression {
attr String name;
@gmf.compartment(foo="bar") // that doesn't work, @gmf.link() does
val Expression add;
}
class Abs extends Function_Simple {
}
class Cos extends Function_Simple {
}
Any help would, as always, be greatly appreciated.
// Edit:
Nevermind, I now transformed that graphic into a pure compartment model. The possibility of an outright mix seems unlikely.
However, putting function parameters into the model as property values still seems interesting.
And, another related question that arose: Instead of modeling the elements as "Abs, Cos, ...", can I just annotate them somehow to only make them "Function_Simple", and, again, have the function's name only as a property value?
It is the same with primitive functions - they'll show up as Addition, Multiplication, ... instead of as an Expression, which makes for poor ability to bidirectionally edit the diagram.
[Updated on: Tue, 28 May 2013 04:19] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02216 seconds