During the discussion there seemed to be some interest as to how the Meta-Environment relates to OMeta, developed by Alessandro Warth. In this post I would like to clarify some of the distinctions.
First of all OMeta uses a grammar formalism that is based on parsing expression grammars (PEGs), whereas the Meta-Environment is based on the syntax definition formalism (SDF), which allows the specification of arbitrary context-free grammars (CFGs). As a result, in Ometa, you won't risk writing ambiguous grammars (that is, grammars which allow multiple derivations for the same string). However, you will have to mould your language's grammar until it fits the PEG framework. In SDF you can write your grammar much more declaratively, and use the full power of CFGs to describe your language. As a consequence, there is a risk of ambiguity. SDF provides a number of disambiguation constructs to amend this situation (follow restrictions, priorities, rejects).
If you look at these distinctions, one could say that OMeta is better at defining (small) interpreters that require a general purpose language and a full-fledged host environment. On the other hand, the Meta-Environment is better fit for constructing compilers and code generation because compilers are essentially (source-to-source) transformations. In addition, the generality of the parsing technology behind the Meta-Environment allows it to be used for other task as well: analysis and transformation of legacy systems.
Currently, when implementing a Domain Specific Language (DSL) using the Meta-Environment one has to resort to code generation for integration with the environment (e.g. for dealing with stuff like files, databases, GUI libraries, sockets etc. — anything that cannot be easily expressed as source-to-source transformation...). It would be interesting to see if the parsing power of SDF could be combined with the(much more dynamic and late-bound) interpretation model of OMeta to make the development of DSLs more light-weight.
No comments:
Post a Comment