It sure did help my project. I see your point about programming language conversion. I'd be suspicious of it too. It's generally a pretty hard thing to do due to fundamental differences in programming languages. I'd hate, for example, to try and convert perl or lisp into VB - lack of lexical closures would just be too crippling.

I didn't think at one time that it would be possible to do justice to a lisp->perl conversion either.

As I've said on my website, the main use I've put this to (apart from compiling itself) is in converting XML from one form to another, whilst validating it at the same time. I wrote the previous version of this program in perl and it worked pretty well. The code was reasonably nice. I always had a feeling, though, that there must be a much easier way of doing it. What I almost wanted was a special purpose 'conversion language', but with the power of a general purpose language. (XSLT would not nearly have done).

I don't see lisp as a non general purpose language, though I realise it was originally intended/used for AI. I think it makes an excellent general language (though perl has its advantages - otherwise I wouldn't use it). I don't think that <it>it</it> was the wrong choice of language. Perl was. It wouldn't have been unreasonable to implement the whole thing in lisp. The lisp code base for this translator is MUCH cleaner, more complete and nicer to work with than the perl one, despite the general strangeness of translating it to perl. Its also faster!

There is one feature of lisp (this one included) which made it worth doing this project in lisp, and that is macros. Macros are _enourmously_ powerful. If you haven't ever used them I'd strongly recommend you look into them. Going from a language w/o macros to one with is like going from a line number version of BASIC to perl (almost/sort of). Paul Graham has written a lot about this (www.paulgraham.com).

Of course, perl 6 is going to implement macros, which will be very cool.


In reply to Re: Re: Lisp to Perl compilation by hhdave
in thread Lisp to Perl compilation by hhdave

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.