Describing a language editor can be repetitive, for instance when you have to define expressions. expression '+' expression
and expression '*' expression
is a typical example. From the grammar file that describes the language structure it's possible to recognize repetitive rule structures and build an editor in a consistent way.
The PE project defines a grammar and generates AST in a way not related to any projectional editor. PE4MPS project imports the generated ASTs into MPS generating for example from this rule:
Graph:
strict=STRICT? type=GraphType name=string?
statementList<indentList('{', '}')>=Statement*
;
this MPS editor:
The defined list of indented statement can be utilized also in:
Subgraph:
(SUBGRAPH label=Id?)?
statementList<indentList('{', '}')>=Statement*
;
giving:
The last example for this small introduction are optional group of elements like:
NodeId:
id=Id (':' first=Id (':' second=Id)?)?
;
translated in MPS into two intentions:
The two mentioned project are still at their very first version and many features are still missing, probably the most important one is scopes handling.