Hi Stef,
do you parse mse?
yes, both. I wrote a generic reader and a generic writer.
or generate it because I did a mse exporter to save
all the version
of seaside
last year.
I know that code. The goal of my implementation is a bit different, it
does not (necessarily) generate output to be consumed by FAMIX.
Which version of mse are you supporting?
I think the version from Monday, but frankly it is quite a mess with
these versions lately. The parser is based on SmaCC so I can fairly
quick adopt it, if necessary.
I wrote that code for the first version of mse and
know I do not
understand anything.
What? I don't get it ;-)
Let me explain what I did:
- I wrote a generic MSEParser. You give it a valid MSE string and it
will return you a graph of Associations, OrderedCollection, and
Dictionaries. That's the default and directly maps to the MSE
structure. Obviously this is not really useful. Now it is possible to
subclass MSEParser and override some hock methods that allow you to
instantiate and build 'real' objects. How you instantiate and
initialize your real objects is up to you or your meta-model. I've
written such parsers for Magritte and for the Smalltalk object model.
- I wrote a generic MSEWriter. You give it a tree of objects and it
writes everything out as a graph. Again the default implementation is
totally stupid, but you can subclass it to tell the engine how to
traverse your objects and what to serialize. I've done this for
Magritte and the Smalltalk object model.
So for me this is merely a way to serialize objects (e.g. for Pier).
This is not much different than what SIXX, JSON, or Hessian are
already doing, except that I can combine it nicely with any read/write
strategy. Of course it would also be possible to enable it to
read/write FAMIX models, but I did not do that right now.
For example:
MSESmalltalkWriter write: 1 @ #( 'mse' 1.1 $a $a ) asOrderedCollection.
'(Point (id: 1)
(x 1)
(y (OrderedCollection (id: 2)
(array
(Array (id: 3)
(_var
''mse''
(Character (id: 4)
(value 97))
(idref: 4))))
(firstIndex 1)
(lastIndex 3))))'
Parsing back that string I get the same object as I wrote out.
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch