Martinfowler's "language workbench" Notes

Source: Internet
Author: User
Tags define abstract

When the MPs of jetbrains came out, Martin Fowler also made a great effort to write the article "language workbenches: The killer-app for domain specific ages?". Become a general article interested in the lop and DSL fields.

First, it is important to understand Martin Fowler's position. However, in order to ensure the reading rate, MF puts its position at the end.

1. The two biggest advantages brought by LOP are:
A. Improve the productivity of programmers through new encapsulation and thinking modes.
B. Change the relationship between programmers and experts in the field. The ideal situation is that experts in the field directly use DSL programming.
Mf believes that the effect of is much greater than that of, but it is also much more difficult. When we first came out of COBOL, someone mentioned the expert in the field for direct programming. What is the result?

2. Now we know little about what DSL looks like, text language? Graphic Language? Everything is still being assumed.

3. the Lop tool is still in very initial stages.

4. however, MF also believes that lop is currently the most interesting idea. Whether it succeeds in the future, it will inspire a lot of interesting ideas and practices. Note that lop will never suffer losses.

Is there a sudden decrease in enthusiasm? The release of MPs makes the Lop seem like something that can be started tomorrow. Now it's interesting, but it's far from time to time.

Read the article from scratch
1. Start with a simple example of Lop
The example taken by Martin takes up 1/3 of the full text, which is long and does not stimulate nerves. As you can see, people often get up and eat snacks and go to the toilet ....
 
2. Traditional Lop
MDA is not a new concept, and DSL certainly does not need to be. dsl has long been around, including
1. Mini DSL built with yacc in UNIX
2. LISP and FP construct DSL by themselves
3. xml configuration file
4. Gui description file (VB, Delphi ....)
5. Adaptive object models and active data models? (Not fully understood)
(Note: SQL is correct)

3. External DSL and internal DSL
DSL is divided into two types: Internal and External. For example, YACC, which translates DSL parser into base language, belongs to external DSL.
LISP, which uses the language itself to construct a new language, is called internal DSL.

The advantage of external DSL is that it can be anything and is not restricted by the base language. In addition, it is usually explained during runtime.
Bad:
First, it takes a lot of time to design languages, write parser, write generator, and write IDE.
Second, you cannot directly use the base-language IDE, Which is unpleasant in the later intellij age.
Third, we need to learn too many languages and ways of thinking, not the differences in the IF-else syntax, but in Java we are used to expressing ideas using object and method, however, different concepts may be used in other DSL systems, such as the example at the beginning of the article.

However, the advantages and disadvantages of internal DSL and external DSL are quite different. In addition, the syntax of Lisp and smalltalk is very different from that of Java and C. Also, ruby may be used to write internal DSL recently.

It is precisely because both kinds of DSL have clear disadvantages that DSL is not so popular today. Language workbeanch is designed to make external DSL easy to appear.

4. Today's language workbeanch
There are intentional software IP addresses, jetbrains MPs and Microsoft software factories.

1. a DSL will have an editble reprensentation, a storage reprentsentation, a compiled excuteble reprentsentation, and an Ast-astraction reprensentation in the editor. Editble and storage reprensentation can be combined or separated.
2. Define three steps for a new DSL:
A. Define the schema of the language
B. Define the editor
C. Define Generator
A DSL can have multiple editors and code generators.

 5. Advantages and Disadvantages of language workbench
Advantages:
1. Skip writing parser and define abstract syntax directly.
2. Save writing IDE.
3. Ide syntax prompts and syntax checks make it possible for experts in the field to write them directly, which is not available in the COBOL era.
4. Good integration between DSL and projects. It can refactor the project and DSL syntax, and use the language while designing the language.

Disadvantages:
1. vendor exclusive. With MPs, it is impossible to switch to IP addresses or Microsoft, because there is no standard between them.
2. However, generator is not much simpler than before ).
3. Now the code is centered on astraction reprensention and version management. Ast supports diff/merge.

6. My position
I tried MPs for a moment, because the generator has not made a revolutionary breakthrough, and MPs has not been truly available yet.
However, in a few months, MPs EAP has been upgraded from the initial version 150 to version 220, so you cannot ignore its progress.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.