PE grammar (was MPSGrammar... API or templates? )

Hi,

it took to me several nights to clean the first implementation of a grammar to express MPS languages. Target languages are old style text based languages normally used by the last generator phase before they get translated to text with TextGen.
I found implementing such a languages very ripetitive in MPS.

I saw some work done in this direction recently by the MPS gurus working at the mbeddr project.

I'm almost ready to publish the PE project (Apache license) and I plan to do it before Xmas.
This is an overview because I'm very interesting on the feedback from MPS users.

So, the language I choose for first tests is DOT. Some rules are:
Graph:
  strict=STRICT? type=GraphType name=Id?
  statementList<indentList, '{', '}'>=Statement*
;
NodeStatement:
  nodeId=NodeId lists<vList>=AttributeList*
  ';'
;
NodeId:
  id=Id (':' first=Id (':' second=Id)?)?
;
EdgeStatement:
  start=EdgeEnd endList<hList, '', '', ''>=EdgeRHS+
  lists<vList>=AttributeList*
  ';'
;
EdgeRHS:
  operator=EdgeOperator end=EdgeEnd
;
prettyPrint();
This together with all the other rules will be imported without any user intervention into this language:
pe-language-dot.png

Just rebuild the language and one can insert this graphviz graph:
pe-graph-g.png

Please sign in to leave a comment.