<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>java rants &#187; dsl</title> <atom:link href="http://www.javarants.com/tag/dsl/feed/" rel="self" type="application/rss+xml" /><link>http://www.javarants.com</link> <description>Rants about Java and other internet technologies by Sam Pullara</description> <lastBuildDate>Sun, 09 Oct 2011 23:29:31 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <item><title>What should a domain specific language workbench look like?</title><link>http://www.javarants.com/2005/07/10/what-should-a-domain-specific-language-workbench-look-like/</link> <comments>http://www.javarants.com/2005/07/10/what-should-a-domain-specific-language-workbench-look-like/#comments</comments> <pubDate>Sun, 10 Jul 2005 16:54:03 +0000</pubDate> <dc:creator>Sam Pullara</dc:creator> <category><![CDATA[Java]]></category> <category><![CDATA[Technology]]></category> <category><![CDATA[dsl]]></category> <category><![CDATA[language]]></category> <guid
isPermaLink="false">http://www.javarants.com/?p=996</guid> <description><![CDATA[What should a domain specific language workbench look like?  <a
href="http://www.javarants.com/2005/07/10/what-should-a-domain-specific-language-workbench-look-like/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div><span
style="font-family: Helvetica;">I just got done looking at the <a
href="http://www.jetbrains.com/mps/start/index.html">Hello, world! tutorial of JetBrains MPS</a>.  It shows in disgusting detail how incredibly ridiculous this tool is.  Not since <a
href="http://home.sampullara.com/~sam/shared/hello/jinihelloworld.html">JINI&#8217;s Hello, world! tutorial</a> have I seen something that is such an anti-advertisement for a product.</span></div><div><span
style="font-family: Helvetica;">So you might read this and ask, &#8220;if you&#8217;re so smart why don&#8217;t you come up with some huge language workbench and show them who&#8217;s boss?&#8221;.  Well, I don&#8217;t have time for that, as I will not use enough domain specific languages over the breadth of my career to make it worth my while to write it myself nor am I interested in trying to sell such a thing.  Instead I will give you a description of a product that I think people could use to do this that wouldn&#8217;t make them want to pull their hairs out one by one.</span></p><p><span
style="font-family: Helvetica;">Let me lay out in broad swaths how my system would work:</span></p><p><span
style="font-family: Helvetica;">1. First determine what your language info set is.  In their example it would be a single string variable.</span><br
/> <span
style="font-family: Helvetica;">2. Now either write an <a
href="http://www.w3.org/XML/Schema">XML schema</a> or if you&#8217;re not a genius use <a
href="http://www.thaiopensource.com/relaxng/trang.html">Trang</a> to generate one from some sample XML.</span></p><p><span
style="font-family: Helvetica;">In their Hello World case we can use the sample XML:</span></p><pre>&lt;HelloText&gt;Hello, world!&lt;/HelloText&gt;</pre><p><span
style="font-family: Helvetica;">Trang cleverly generates the following schema from this:</span></p><pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
 &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"&gt;
   &lt;xs:element name="HelloText" type="xs:string"/&gt;
 &lt;/xs:schema&gt;</pre><p><span
style="font-family: Helvetica;">Which, being a genius, is exactly what I would have done.  Now we have the info set for our little language.  But who wants to type in that ugly XML stuff?</span></p><p><span
style="font-family: Helvetica;">3. Transform the XML schema into a little language from requiring XML input to one based on a chosen style and structure.</span></p><p><span
style="font-family: Helvetica;">For our case, we could choose C-style with a camelCase to whitespace transform. </span></p><p><span
style="font-family: Helvetica;">4. From this generate a lexer, parser, and visitor specifically for this new language.</span></p><p><span
style="font-family: Helvetica;">This mythical tool would then generate a lexer and parser that would take programs that look like this:</span></p><pre>Hello text = "Hello, world!"</pre><p><span
style="font-family: Helvetica;">or maybe we would choose Lisp as our inspiration:</span></p><pre>(HelloText "Hello, world!")</pre><p><span
style="font-family: Helvetica;">Of course the visitor supplied with the parser would then generate StaX events or DOM objects or some other XML representation that you could then use to execute this &#8220;code&#8221;.</span></p><p><span
style="font-family: Helvetica;">Undoubtedly all of these transformations would of course be represented in some domain specific language perfectly suited to the task rather than having to click about 200 times on some terrible GUI interface.</span></p><p><span
style="font-family: Helvetica;">5. For the coup de grace, provide a simple templating system like Velocity or GroovyTemplates to transform the XML into code that can be compiled or we could just choose to interpret the XML at runtime, like Spring does.</span></p><p><span
style="font-family: Helvetica;">Now somebody out there go and write this thing so I don&#8217;t have to.</span></div> ]]></content:encoded> <wfw:commentRss>http://www.javarants.com/2005/07/10/what-should-a-domain-specific-language-workbench-look-like/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
