JSMF-Core
The JavaScript Modelling Framework (JSMF) has been designed for providing a flexible modelling environment that could support the many modelling situations: from informal model to code generation. It is a JavaScript embedded DSL inspired by the Eclipse Modelling Framework (EMF) in its basic functions but that rely on JavaScript dynamic typing and on a relative independence between a metamodel and a model.
Install
Thanks to npm: npm install jsmf-core
Usage and Example
In order to access the most commun JSMF elements use:
const JSMF = Model = JSMFModel Class = JSMFClass Enum = JSMFEnum
Creating a metamodel element (i.e., Class)
Here we created a Class "Family" and a "lastname" attribute. This syntax is inspired by the EMF one.
const Family = ClassFamily
Alternatively you can use a more compact syntax (here defining a Person Class) using javascript objects.
const Person = Class
Now we have the Class "Person" and "Family" let's create a reference between those two Classes.
Family
Creating a model element conforms to a metamodel element.
const john = john firstname = ’ John ’john age = 46
Alternatively you can also use a compact syntax:
const kennedy = Family
You can find examples, discover the other components and test it online with Tonic on JSMF github website (https://js-mf.github.io/#portfolio)
License information
See License.