Simple Object Notation
MIT License
Simon is a framework that supports implementation of DSLs driven by user-provided metamodels.
Imagine there was a conventional way of textually representing object models?
JSON and YAML work fine for object trees. However, object models are more diverse than trees. Simon supports associations between objects.
Simon can be implemented on almost any language.
The first reference implementation happens to be implemented in Java.
You can read more about Simon's metamodel by checking out the documentation generated from the reference implementation (javadoc).
Every Simon program starts with a language declaration (@<language-name>
).
@language <language-name>
...
Every program element is declared by specifying the kind of element, an optional name, and an optional body.
These are all valid Simon programs:
@language UI
application myApplication { }
@language UI
application myApplication
@language UI
application {}
Any element of a kind that contains attributes, properties can be specified as:
<kind> [<name>] ([<attribute-name> : <attribute-value>[ ...]])
Example:
button btn1a (label : 'Ok')
For any element of a kind that admits child elements, children can be specified like this:
screen screen1 (layout : Vertical) {
children {
button btn1a (label : 'Ok')
button btn1b (
label : 'Cancel'
backgroundColor : #(red : 100 green : 50)
)
link(label: 'To screen 2') {
targetScreen: screen2
}
}
}
See an example Simon program describing a user-interface:
@language UI
application myApplication {
screens {
screen screen1 (layout : Vertical) {
children {
button btn1a (label : 'Ok')
button btn1b (
label : 'Cancel'
backgroundColor : #(red : 100 green : 50)
)
link(label: 'To screen 2') {
targetScreen: screen2
}
}
}
screen screen2 {
children {
button btn2a (label : 'Ok')
}
}
screen screen3 {}
}
}