in reply to Re: Lisp to Perl compilation
in thread Lisp to Perl compilation
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Macros v. Source Filter was: Lisp to Perl compilation
by sleepingsquirrel (Chaplain) on Jan 16, 2004 at 16:44 UTC | |
by Elian (Parson) on Jan 16, 2004 at 16:58 UTC | |
by Abigail-II (Bishop) on Jan 16, 2004 at 17:09 UTC | |
by hhdave (Beadle) on Jan 16, 2004 at 18:12 UTC | |
by Elian (Parson) on Jan 16, 2004 at 18:55 UTC | |
by adrianh (Chancellor) on Jan 16, 2004 at 22:15 UTC |