[ale] LISP to C

Pete Hardie pete.hardie at gmail.com
Tue Feb 14 11:37:44 EST 2012


Yeth!

On Tue, Feb 14, 2012 at 11:20, Lightner, Jeff <JLightner at water.com> wrote:
> Shouldn't that be Lithp to Thee?
>
>
>
>
>
> -----Original Message-----
> From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of mike at trausch.us
> Sent: Tuesday, February 14, 2012 11:12 AM
> To: ale at ale.org
> Subject: Re: [ale] LISP to C
>
> On 02/14/2012 11:05 AM, Terry Bailey wrote:
>> Is there a way to convert LISP source code into readable C source code?
>
> No.
>
> Well, probably not.
>
> You're talking about compilation, the only difference being that instead
> of compiling straight to assembly language or an AST, you're generating C.
>
> For example (using Vala because I don't have a LISP-to-C compiler):
> mbt at aloe /tmp/d $ ls -l
> total 8
> -rw-r--r-- 1 mbt mbt 520 Feb 14 11:10 hello.c
> -rw-r--r-- 1 mbt mbt  94 Feb 14 11:09 hello.vala
>
>
> Vala input:
> =========================================================================
> using GLib;
>
> public static int main(string[] args) {
>        stdout.printf("Hello!\n");
>        return(0);
> }
> =========================================================================
>
> C output:
> =========================================================================
> /* hello.c generated by valac 0.14.2, the Vala compiler
>  * generated from hello.vala, do not modify */
>
> #include <glib.h>
> #include <glib-object.h>
> #include <stdlib.h>
> #include <string.h>
> #include <stdio.h>
>
> gint _vala_main (gchar** args, int args_length1);
>
>
> gint _vala_main (gchar** args, int args_length1) {
>        gint result = 0;
>        FILE* _tmp0_;
>        _tmp0_ = stdout;
>        fprintf (_tmp0_, "Hello!\n");
>        result = 0;
>        return result;
> }
>
>
> int main (int argc, char ** argv) {
>        g_type_init ();
>        return _vala_main (argv, argc);
> }
> =========================================================================
>
> Trust me, it gets a *lot* worse from there.  Non-trivial programs become
> *extremely* difficult to read.
>
> What are you trying to accomplish?  Could you follow the same model as
> Vala, where you precompile the specialty language and only distribute
> the pre-generated C?
>
>        --- Mike
>
> --
> A man who reasons deliberately, manages it better after studying Logic
> than he could before, if he is sincere about it and has common sense.
>                                   --- Carveth Read, "Logic"
>
>
>
>
>
> Athena(r), Created for the Cause(tm)
> Making a Difference in the Fight Against Breast Cancer
>
> ---------------------------------
> CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.
> ----------------------------------
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo



-- 
Pete Hardie
--------
Better Living Through Bitmaps



More information about the Ale mailing list