Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
new lisp translators?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  13 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Francogrex  
View profile  
 More options Apr 25 2012, 1:34 pm
Newsgroups: comp.lang.lisp
From: Francogrex <fra...@grex.org>
Date: Wed, 25 Apr 2012 10:34:01 -0700 (PDT)
Local: Wed, Apr 25 2012 1:34 pm
Subject: new lisp translators?
I know of the lisp to js (parenscript) and lisp to Dylan (ltd) translators, any updates on "new" lisp to C translators. I'm of course interested in those that translate into the run-of-the-mill human readable C code that can be compiled and run without using external lisp libraries (so not ecl or thinlisp, those have been covered in previous topics). If anyone got any news please share here thanks

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
daniel.elia...@excite.com  
View profile  
 More options Apr 25 2012, 3:31 pm
Newsgroups: comp.lang.lisp
From: daniel.elia...@excite.com
Date: Wed, 25 Apr 2012 12:31:43 -0700 (PDT)
Local: Wed, Apr 25 2012 3:31 pm
Subject: Re: new lisp translators?
I assume such C code output would have all variables based on some generic pointer - then I guess point to some cell including a tag to indicate data type, then there's a library needed for arithmetic among types and other ops among types...

I don't think it's possible to get away from a run time support library, unless you strongly constrain the input Lisp code constructs..

Then there is also the need to support live symbols and have the symbol table live...

BUT - WHAT I DO HOPE- is that you could have a partitioned library wherein only those run time parts that are referenced in the code need be included.  For instance, if the symbol table is not referenced in the code (no INTERN, no SYMBOL-NAME, or the like), then the live symbol table need not be included, and any symbols directly mentioned in the code could be optimized out, like muted to unique values instead of symbols, or something.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Apr 25 2012, 4:04 pm
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Wed, 25 Apr 2012 22:04:37 +0200
Local: Wed, Apr 25 2012 4:04 pm
Subject: Re: new lisp translators?

So:

    --------------------------------------------------
    (defun fact (x)
      (if (< x 1)
         1
         (* x (fact (1- x)))))

    (defun main ()
       (format t "~A~%" (fact 100)))
    --------------------------------------------------

would translate to:

    --------------------------------------------------
    #include <stdio.h>

    int fact(int x){
        if(x<1){
            return(1);
        }else{
            return(x*fact(x-1));
        }
    }

    int main(void){
        printf("%d\n",fact(100));
        return(0);
    }
    --------------------------------------------------

Oops, already you have to use a library, C doesn't have I/O built-in.

Let's just ignore that:

============================================================
Running the C program:
============================================================
./c_fact
0

============================================================
Running the Lisp program:
============================================================
./fact
933262154439441526816992388562667004907159682643816214685929638952175999932 299156089414639761565182862536979208272237582511852109168640000000000000000 00000000
============================================================

To get the same result in C, you need to use yet another library, mpz,
and then the code is not maintainable anymore:

    --------------------------------------------------
    #include <stdio.h>
    #include <gmp.h>

    mpz_t one;

    void fact(mpz_ptr r,mpz_srcptr x){
        if(mpz_cmp(x,one)<0){
            mpz_set(r,one);
        }else{
            mpz_t rr;
            mpz_t x_minus_1;
            mpz_init(rr);
            mpz_init(x_minus_1);
            mpz_sub(x_minus_1,x,one);
            fact(rr,x_minus_1);
            mpz_mul(r,rr,x);
            mpz_clear(rr);
            mpz_clear(x_minus_1);
        }
    }

    int main(void){
        mpz_t r;
        mpz_t arg;

        mpz_init(one);
        mpz_set_ui(one,1);

        mpz_init(r);
        mpz_init(arg);
        mpz_set_ui(arg,100);
        fact(r,arg);
        gmp_fprintf(stdout,"%Zd\n",r);
        mpz_clear(r);
        mpz_clear(arg);
        return(0);
    }
    --------------------------------------------------

============================================================
Running the C program with mpz:
============================================================
./mpz_fact
933262154439441526816992388562667004907159682643816214685929638952175999932 299156089414639761565182862536979208272237582511852109168640000000000000000 00000000

And this is just for *; there are 977 other symbols in CL…

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Bradshaw  
View profile  
 More options Apr 26 2012, 5:36 am
Newsgroups: comp.lang.lisp
From: Tim Bradshaw <t...@tfeb.org>
Date: Thu, 26 Apr 2012 10:36:59 +0100
Local: Thurs, Apr 26 2012 5:36 am
Subject: Re: new lisp translators?
On 2012-04-25 17:34:01 +0000, Francogrex said:

> I know of the lisp to js (parenscript) and lisp to Dylan (ltd)
> translators, any updates on "new" lisp to C translators. I'm of course
> interested in those that translate into the run-of-the-mill human
> readable C code that can be compiled and run without using external
> lisp libraries (so not ecl or thinlisp, those have been covered in
> previous topics). If anyone got any news please share here thanks

Why is such a thing interesting?  As someone else has pointed out it's
virtually impossible to translate a language like CL to run-of-the-mill
C because CL maps so poorly onto C (for stance something like (defun
foo (x y) (+ x y)) would require an enormous implementation in C).

To translate to readable C at all would really require a much
lower-level Lisp - one whose arithmetic mapped much more closedly onto
C's, for instance, as well as many other things (there are or were such
languages I think which were used to port bigger environments).  But
even then, the question would be: why?  I can see that Lisp systems
which used C as an intermediate language were at least once
interesting, and might still be to support very small embedded systems
(which might now be equivalent to the kind of departmental mini they
once were useful for), but those systems never produced readable C.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
daniel.elia...@excite.com  
View profile  
 More options Apr 26 2012, 11:51 am
Newsgroups: comp.lang.lisp
From: daniel.elia...@excite.com
Date: Thu, 26 Apr 2012 08:51:00 -0700 (PDT)
Subject: Re: new lisp translators?

On Thursday, April 26, 2012 5:36:59 AM UTC-4, Tim Bradshaw wrote:
> To translate to readable C at all would really require a much
> lower-level Lisp - one whose arithmetic mapped much more closedly onto
> C's...

Yes, like Emacs Lisp.  Or else you could say the translator uses native C numbers only when the types are so specified in CL, otherwise the translator does something like Pascal showed earlier.

Point is for the runtime to be minimally constructed - but that minimum could be huge depeding on features used in the Lisp source.

>  But
> even then, the question would be: why?  I can see that Lisp systems
> which used C as an intermediate language were at least once
> interesting, and might still be to support very small embedded systems...

That is precisely my own interest, actually - then I could do coding and test benching on PCs, and being in Lisp would facilitate the test bench environments.  Even substituting the PC test bench into the embedded environment (for instance when I/O is GbEthernet).  Then gen code for the embedded processor.

If the embedded runtime could end up with a basic symbol table - perhaps read only with a subset of symbols included - supporting a REPL, then that could be even better for embedded debugging and/or system control.

> ... but those systems never produced readable C.

Personally, I don't care about readability as Francogrex mentioned; only automatic minimality.. (Is that a word?)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Apr 26 2012, 11:55 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Thu, 26 Apr 2012 17:55:40 +0200
Local: Thurs, Apr 26 2012 11:55 am
Subject: Re: new lisp translators?

Just use libecl.so

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Bradshaw  
View profile  
 More options Apr 26 2012, 2:45 pm
Newsgroups: comp.lang.lisp
From: Tim Bradshaw <t...@tfeb.org>
Date: Thu, 26 Apr 2012 19:45:54 +0100
Local: Thurs, Apr 26 2012 2:45 pm
Subject: Re: new lisp translators?
On 2012-04-26 15:51:00 +0000, daniel.elia...@excite.com said:

> Personally, I don't care about readability as Francogrex mentioned;
> only automatic minimality.. (Is that a word?)

Tree shaking is how I'd think of it.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Bradshaw  
View profile  
 More options Apr 26 2012, 2:48 pm
Newsgroups: comp.lang.lisp
From: Tim Bradshaw <t...@tfeb.org>
Date: Thu, 26 Apr 2012 19:48:22 +0100
Local: Thurs, Apr 26 2012 2:48 pm
Subject: Re: new lisp translators?
On 2012-04-26 15:51:00 +0000, daniel.elia...@excite.com said:

> That is precisely my own interest, actually - then I could do coding
> and test benching on PCs, and being in Lisp would facilitate the test
> bench environments.  Even substituting the PC test bench into the
> embedded environment (for instance when I/O is GbEthernet).  Then gen
> code for the embedded processor.

I used to wonder about writing a Lisp syntax front-end for something
like C: so you'd actually *be* writing C, but you'd write it in sexps.  
You could then have a runtime for it in your development enviromnent
but finally have the thing generate C for the target.  I bet that has
been done in fact.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anthony Ventimiglia  
View profile  
 More options Apr 26 2012, 9:12 pm
Newsgroups: comp.lang.lisp
From: Anthony Ventimiglia <ajve...@gmail.com>
Date: Thu, 26 Apr 2012 18:12:33 -0700 (PDT)
Local: Thurs, Apr 26 2012 9:12 pm
Subject: Re: new lisp translators?
I should preface this with saying that as much as I would prefer to code in Lisp all the time, I find things like parenscript, cl-who, S-sql and clsql disgusting. I do however see how they can be useful to some people. For example javascript at this point is essentially the assembler language of web browsers, with a few big bonuses. It's basically standardized (unlike assembler which is specific to the processor) and it is a high level (and quite lisp like) language.

I hate that I see no real reason to do something like this, but what's the point of using Lisp to compile code into a language (C)that then has to be compiled and linked again? It may be a bit interesting (and masochistic) to undertake such a project, but not very useful. I could see if you wanted to build a lisp .so library with symbols exported in a way that they could be called from C code, similar to the way some parts of C applications are coded directly in assembler.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daimrod  
View profile  
 More options Apr 27 2012, 1:01 am
Newsgroups: comp.lang.lisp
From: Daimrod <daim...@gmail.com>
Date: Fri, 27 Apr 2012 07:01:43 +0200
Local: Fri, Apr 27 2012 1:01 am
Subject: Re: new lisp translators?

I like Postmodern to play with a PostgreSQL database from SLIME-REPL, I
find it way more nicer than the available REPL or an UI like phppgadmin.
Also, writing SQL queries with quasiquotation is much nicer than
concatenating strings.

I'm not (yet?) a big fan of Parenscript, though it makes the integration
of XHTML and Javascript consistent with cl-who or cl-markup.
i.e. I keep the View clean in s-exp and call .js written in plain Javascript.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Apr 27 2012, 6:46 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Fri, 27 Apr 2012 12:46:19 +0200
Local: Fri, Apr 27 2012 6:46 am
Subject: Re: new lisp translators?

One real reason is that sexp programming lets you avoid SQL injection
(and similar bugs).  Since sexps are always fully parenthesized, or more
exactly since manipulating sexps is actually manipulating a hierarchical
data structure, you don't have the problems you can have when
manipulating a linear data structure such as a string, where an
"ill-formed" string can change its own structural meaning.

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ddd  
View profile  
 More options May 8 2012, 4:14 am
Newsgroups: comp.lang.lisp
From: ddd <d...@ddd.dd>
Date: 08 May 2012 08:14:06 GMT
Local: Tues, May 8 2012 4:14 am
Subject: Re: new lisp translators?

On Wed, 25 Apr 2012 10:34:01 -0700 (PDT), Francogrex <fra...@grex.org> wrote:
> I know of the lisp to js (parenscript) and lisp to Dylan (ltd)
>translators, any updates on "new" lisp to C translators. I'm of course
>interested in those that translate into the run-of-the-mill human
>readable C code that can be compiled and run without using external
>lisp libraries (so not ecl or thinlisp, those have been covered in
>previous topics). If anyone got any news please share here thanks

For scheme have a look at:
http://people.csail.mit.edu/jaffer/Schlep/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tar...@google.com  
View profile  
 More options Jul 25 2012, 5:54 pm
Newsgroups: comp.lang.lisp
From: tar...@google.com
Date: Wed, 25 Jul 2012 14:54:27 -0700 (PDT)
Local: Wed, Jul 25 2012 5:54 pm
Subject: Re: new lisp translators?

On Thursday, April 26, 2012 11:48:22 AM UTC-7, Tim Bradshaw wrote:
> On 2012-04-26 15:51:00 +0000, daniel.elia...@excite.com said:

> &gt; That is precisely my own interest, actually - then I could do coding
> &gt; and test benching on PCs, and being in Lisp would facilitate the test
> &gt; bench environments.  Even substituting the PC test bench into the
> &gt; embedded environment (for instance when I/O is GbEthernet).  Then gen
> &gt; code for the embedded processor.

> I used to wonder about writing a Lisp syntax front-end for something
> like C: so you&#39;d actually *be* writing C, but you&#39;d write it in sexps.  
> You could then have a runtime for it in your development enviromnent
> but finally have the thing generate C for the target.  I bet that has
> been done in fact.

Sort of.
See Stella:  http://www.isi.edu/isd/LOOM/Stella

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »