title: writing a portable domain specific language
body: <p>I'd like to know good strategies for deploying a domain-specific-language which must run under at least 2 languages (Java, C#) and probably more (Python, and possibly Javascript).</p>
  
  <p>Some background. We have developed and deployed a domain-specific language currently written in C#. It's deployed though a series of method calls whose arguments are either common language primitives (string, double, etc.), Collections (IEnumerable, HashSet, ...) or objects in a domain-specific library (CMLMolecule, Point3, RealSquareMatrix). The library is well tested and the objects have to comply to a stable deployed XML schema so change will be evolutionary and managed (at least that's the hope).</p>
  
  <p>We hope the language will become used by a wide and partially computer-literate community, used to hacking their own solutions without central control. Ideally the DSL will create a degree of encapsulation and produce the essential functionality they need. The libraries will manage the detailed algorithms which are many and varied but fairly well known. There's a lot in common with the requirements of the DSL in <a href="https://stackoverflow.com/questions/1485006/domain-specific-languages-vs-library-of-functions">Domain-specific languages vs. library of functions</a>.</p>
  
  <p>I'd appreciate ideas on the best architecture (clearly once it's deployed we cannot easily backtrack). The choices include at least:</p>
  
  <ul>
  <li>Creation of an IDL (e.g. through CORBA). The W3C did this for the XML DOM - I hated it - and it seems to be overkill</li>
  <li>manual creation of similar signatures for each platform and best endeavour to keep them in sync.</li>
  <li>Creation of a parsable language (e.g. CSS).</li>
  <li>declarative programming in XML (c.f. XSLT). This is my preferred solution as it can be searched, manipulated, etc.</li>
  </ul>
  
  <p>Performance is not important. Clarity of purpose is.</p>
  
  <p><strong>EDIT</strong> There was discussion as to whether application calls contitute a DSL. I have discovered Martin Fowler's introduction to DSLs (<a href="http://martinfowler.com/dslwip/Intro.html" rel="nofollow noreferrer">http://martinfowler.com/dslwip/Intro.html</a>) where he argues that simple method calls (or chained calls) can be called a DSL. So a series like:</p>
  
  <pre><code>point0 = line0.intersectWith(plane);
  point1 = line1.intersectWith(plane);
  midpoint = point0.midpoint(point1);
  </code></pre>
  
  <p>could be considered a DSL</p>