On Mon, 2002-09-09 at 09:07, Ramesh Ananthakrishnan wrote:
> 
> Er... it is a silly thing to ask, but is there any way to write C code that comes 
>out assembled in Parrot? 
> 
> Has C been targeted at parrot? Is it a logical thing to do? Does it make sense. (I 
>tried this in my brain for three days and am still confused over whether it is a 
>sensible thing to do). It seems to me that lots of stuff already written in C could 
>be brought to Parrot with the least of fuss.

There are many reasons why you would want to gain access to existing C
code. Here are some examples:

Access to existing libraries -- The POSIX/ANSI C libraries are probably
the most obvious example here. Parrot will need some way to dynamically
link to existing libraries (be they C, C++, FORTRAN or whatever) in the
same way that Perl 5 did. The difference will be that any language
compiled down into PBC will then have access to them, where Perl 5's XS
was only available to Perl.

Using small sections of code -- If you buy "Algorithms in C" and find
something you want to use, it's probably best to re-write it as a module
in Perl or some other high-level language and compile down to PBC. This
will force you to re-think where Parrot and your high-level language
might already provide some or all of what you want.

Moving projects over to a Parrot-based language -- Here, I expect you
will be combining the above strategies, depending on project size. Some
of the existing project's libraries will stand alone well enough to be
used externally (no translation required). The rest, you will probably
want to translate to something like Perl.

So, no I don't think translating C to PBC will make a whole lot of
sense, and translating to a high-level language will almost have to be
manual.

I hope this helps.

-- 
Aaron Sherman <[EMAIL PROTECTED]>
http://www.ajs.com/~ajs

Reply via email to