Please find below the latest draft of the MSE format
There is a new mse element, annotations, which can be used twofold
(1) To structure mse files into multiple documents. For example an mse file may contain an @mse header document and both a @metamodel and @model document, or even multiple @version1 @version2 ... documents. The only reserved annotation would be @mse for the leading header document.
So a valid document could eg look like this
@mse ((MSE.File (metamodel 'http://moose.unibe.ch/spec/famix/3.0') (model '@model')) @model ((FAMIX.Package (id: 1) (name 'LAN') (classes (FAMIX.Class ... ... ... ))))
(2) Annotations for elements. Attribute names may start with an @ to indicate an attribute not conforming to the metamodel, for example the longDesc of a Moose measurement, or the category of a Moose meny entry would use this feature. But also the variable indexed slots of Magritte elements.
(MA.Element (name 'ABC') (attr 0.5 0.75 -1 0.2) (@1 'foo') (@2 'bar') (@3 nil) (@4 'qux'))
Also there are two new primitives
- Nil - Datetime
Nil is not to be confused with unset values, which may have a default value different from nil
(... absent = default value (attr ) = default value (attr nil) = nil value (attr "..some..") = some value ...)
Similar to SAX, there is a ParserClient interface for reading MSE documents using callbacks. This interface allows an application to register for MSE document parsing. The sequence of callbacks is limited to the following protocol
MAIN := beginFile ( annotation* beginDocument ELEM* endDocument )* endFile ELEM := beginElement serial? (beginAttribute ( primitive | reference | ELEM )* endAttribute) endElement
which is based on this grammer and tokens
root := fragment | file fragment := elementNode file := document* document := annotation* "(" elementNode* ")" annotation := AT_NAME elementNode := "(" elementName serial? attributeNode* ")" elementName := NAME attributeNode := "(" attributeName valueNode* ")" attributeName := NAME | AT_NAME valueNode := primitive | id-reference | reference | elementNode primitive := STRING | NUMBER | BOOLEAN | DATE | NIL serial := "(" "id:" INTEGER ")" id-reference := "(" "idref:" INTEGER ")" reference := "(" "ref:" NAME ")"
Breaks input-stream into tokens. Accepts the following grammar
Tokens
Open ::= "(" Close ::= ")" AtName ::= "@" ( Letter | Digit )+ Keyword ::= "id:" | "idref:" | "ref:" Name ::= Letter ( Letter | Digit )* ( "." ( Letter | Digit )+ )* String ::= ( "'" [ˆ']* "'" )+ Boolean ::= "true" | "false" Nil ::= "nil" Date ::= Digit{4} "-" Digit{2} "-" Digit{2} ( "," Digit{2} ":" Digit{2} ":" Digit{2} ) Number ::= "-"? Digit+ ( "." Digit+ )? ( "e" ( "-"? Digit+ ))?
Terminals
Digit ::= [0-9] Letter ::= [a-zA-Z_]
Whitespace
Whitespace ::= Space Tab ecetera... Comment ::= """ [ˆ"] """
----
What do you think? AA