// the YML homepage include homepage.en.yhtml2 page "YML - Why a Markup Language?!" { h1 > Introduction p >> Modelling approaches like ¬http://www.microsoft.com/soa/products/oslo.aspx Microsoft Oslo¬ or ¬http://www.eclipse.org/modeling/emf/ Eclipse Modeling Framework¬ are trying to reach the situation, that a programmer can define what he wants to have, and not only how to implement it technically. >> p >> Both projects are doing this in a complex way. With the CodeGen project, I'm trying to provide a generation framework plain and simple. >> p >> Because one of the problems to solve is a possibility to quickly define Domain Specific Languages and to work with them, I created YML. YML is very easy to use - but it does not do the complete job itself. As a matter of fact, I'm leveraging most of the features from the XML toolchain. >> p >> XML has the possibilities to do the job of creating Domain Specific Languages already; so my approach is to make these features fit in a concept for Declarative Programming and Code Generation. >> h2 id="xml" > XML - a language to design languages already there p >> Any time a ¬http://en.wikipedia.org/wiki/Formal_language formal language¬ is created for ¬http://en.wikipedia.org/wiki/Computing computing¬, a compromise has to be found: whether the language is perfect for the computer but terrible for the human or vice versa. ¬http://www.w3.org/XML/ XML¬ is very good for the computer ;-) >> p >> Using XML for the reasons mentioned above, but for ¬http://en.wikipedia.org/wiki/Computer_programming programming¬? "Why a ¬http://en.wikipedia.org/wiki/Markup_language Markup Language¬?!" was what I was shouting some time playing around with a ¬http://en.wikipedia.org/wiki/Automatic_programming code generator¬ in ¬http://www.w3.org/TR/xslt XSLT¬. That gave the idea. >> h2 id="motivation" > Motivation p >> Many people don't write XSLT directly, because they don't like writing programs in angle brackets. The result usually is, that people are writing ¬http://java.sun.com Java¬ programs, and are processing XML from Java, or are using XSLT features from Java programs. >> p >> But that is very inefficient - there are small and quick XSLT processors, and there are no advantages at all to implement that in Java or ¬http://en.wikipedia.org/wiki/C++ C++¬ usually. >> p >> So I wanted to have something like a Java or ¬http://en.wikipedia.org/wiki/C_(programming_language) C¬ like language, which can be easily translated into XSLT. Then a common XSLT processor can process the program, and XML can be processed very quickly (see also the ¬yslt#sample YSLT sample program¬). >> p >> I started this, because I saw, that code generation for Automated Software Engineering can be implemented very easily in XSLT - but writing XSLT is annoying. >> h2 id="howitworks" > How it works: Replacing angle brackets with some Python p > Just writing down what I wanted to have instead of XML for a sample: Code || Goods Price Beer 20 Wine 30 || p > Something like that should be more easy, say, like this: Code || list "List of goods" { head { title > Goods title > Price } row { value > Beer value > 20 } row { value > Wine value > 30 } } || h2 id="ylanguages" > Y Languages p >> The latter is what I call an Y language - a language specified in YML. How could this be achieved? Well, what's to do? To have the required information, how to build XML from the script above, we need: >> ul { li >> the information, that "list of goods" is an attribute named "name", while "Goods" is the text value of a tag >> li > "title" shout be written out as "columnTitle" } p > How to do that? Let's invent a simple definition language for that information: Code || decl list(name); decl title alias columnTitle; || p > Here you can ¬list.yml2 download the complete list sample¬. div id="bottom" > ¬#top ^Top^¬ ¬programming >> Using YML 2¬ ¬index.en.yhtml2 (source)¬ }