Eclipse Modeling Framework
EMF provides code generation facilities
for building applications based on structured data models
model specification can be done using UML
Xtext
automatically infers EMF-metamodel for DSL
uses EMF to create abstract syntax tree
can also use existing metamodel & generate grammar
instances of EMF classes must be created through a static factory
fields (features) are initialized using getters and setters
or other ways
Ecore model
features
collection of entities
of the model
EMF analogue of string
reference
reference
feature name – when resolving cross-references,
objects are checked against this feature
class hierarchy
base type
extends base type
BasicType, EntityType
become subclasses of FieldType
Ecore model
IntConstant, StringConstant, BoolConstant, FieldRef
become subclasses of Expression
PrintStatement, AssignmentStatement
become subclasses of Statement
represented as string
if both PrintStatement
and
AssignmentStatement
had feature expression,
then Statement
would have field
expression
feature expression
feature expr
no fields
Eclipse Modeling Framework
entity A { }
entity B extends A {
n
number
number n
}

Xtext: Eclipse Modeling Framework

  • 1.
    Eclipse Modeling Framework EMFprovides code generation facilities for building applications based on structured data models model specification can be done using UML Xtext automatically infers EMF-metamodel for DSL uses EMF to create abstract syntax tree can also use existing metamodel & generate grammar instances of EMF classes must be created through a static factory fields (features) are initialized using getters and setters or other ways
  • 2.
    Ecore model features collection ofentities of the model EMF analogue of string reference reference feature name – when resolving cross-references, objects are checked against this feature class hierarchy base type extends base type BasicType, EntityType become subclasses of FieldType
  • 3.
    Ecore model IntConstant, StringConstant,BoolConstant, FieldRef become subclasses of Expression PrintStatement, AssignmentStatement become subclasses of Statement represented as string if both PrintStatement and AssignmentStatement had feature expression, then Statement would have field expression feature expression feature expr no fields
  • 4.
    Eclipse Modeling Framework entityA { } entity B extends A { n number number n }