Expressing DSLs in Lisp is quite different from doing so in other languages. In general you can't express DSLs in other languages in any useful sense (only by writing an interpreter in that language or writing a compiler to that language). In Lisp, though, using macros you can modify the language you are using, adapting it it to the problem domain.

This is easy to do and certainly not trivial (in terms of usefulness). For example, you might need a language for validating the structure of documents. DTDs are one example of these. In Lisp you can implement a series of macros so that you can express DTDs directly in Lisp (I've done this), then the DTD executes as a Lisp program. You just write DTDs using parenthesis instead of the usual syntax.

Or, consider something like YACC. YACC is a DSL for writing parsers. You could write a parser directly in C, but it would be very tedious. YACC programs (or specs or whatever they're called) are not C programs, though they get translated into C. In Lisp you could just extend the language to implement the semantics of YACC. You wouldn't need a separate YACC program.

Lisp is different.

As Guy Steele said: If you give a programmer FORTRAN, he has FORTRAN. If you give a programmer Lisp, he has any language he wants. Turing completeness isn't really the issue. Lisp is really convenient for implementing useful DSLs.


In reply to Re^5: Multiple representations by hhdave
in thread Multiple representations by zby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.