Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perl 6 in Perl 6?

26 views
Skip to first unread message

Darren Duncan

unread,
Oct 18, 2012, 3:02:49 AM10/18/12
to p6l
Something (PyPy et al) got me wondering, is it a goal in the Perl community
before too long to have a (compiling) implementation of Perl 6 written entirely
in Perl 6? Meaning, that at some point the entire non-optional codebase of the
Perl 6 compiler (not just the parser) would be written in pure Perl 6? This
doesn't necessarily have to produce machine language; it could be another
language that needs compiling itself externally, but the point is that the
entire process of producing that target language out of Perl 6 would be written
in Perl 6. I know STD.pm does this for the parsing portion, but I'm wondering
about the rest. (Maybe the all-Perl-6 version would also eventually be able to
produce the fastest running Perl 6 programs too, because it is easiest to write
Perl 6 analysers/optimizers/etc in, corresponding to PyPy as I understand it.)
-- Darren Duncan

Moritz Lenz

unread,
Oct 18, 2012, 3:59:21 AM10/18/12
to perl6-l...@perl.org

On 10/18/2012 09:02 AM, Darren Duncan wrote:
> Something (PyPy et al) got me wondering, is it a goal in the Perl
> community before too long to have a (compiling) implementation of Perl 6
> written entirely in Perl 6?

A fair amount of the two major Perl 6 compilers, Rakudo and Niecza, are
already written in Perl 6.
Both also contain runtime code written in the "native" underlying
language (C/C#), and plans to get rid of that are not realistic right now.

Currently the code generated for Perl 6 code simply can't compete
speed-wise with hand-written C or C# code.

> (Maybe the all-Perl-6 version would also eventually be able to
> produce the fastest running Perl 6 programs too, because it is easiest
> to write Perl 6 analysers/optimizers/etc in, corresponding to PyPy as I
> understand it.)

But since we are still far away from the point where Perl 6 runs faster
than C/C#, we would sacrifice much performance by moving to an all-Perl
6 implementation. So we don't.

Rakudo got rid of much PIR code in the last months, and mostly replaced
it with NQP, which is a subset of Perl 6 (NQP = Not Quite Perl), which
makes it far more hackable. For example the whole code generation is now
written in NQP.

The priorities for most compiler hackers is to provide good compilers
over complete bootstrapping, and I guess most users agree with that goal.

Cheers,
Moritz

Parrot Raiser

unread,
Oct 18, 2012, 11:57:34 AM10/18/12
to Moritz Lenz, perl6-l...@perl.org
On Thu, Oct 18, 2012 at 3:59 AM, Moritz Lenz <mor...@faui2k3.org> wrote:
>
> The priorities for most compiler hackers is to provide good compilers over
> complete bootstrapping, and I guess most users agree with that goal.
>
Agreed.

I'm most concerned about a reliable and consistent set of features
being defined, so I can learn them once, without having to backtrack
when they change.

No disrespect to the people working so hard to make it happen, but
Perl 6 is conceptually so big. It's hard to carve out a mind-size
chunk to learn and reinforce when things keep wobbling.

Patrick R. Michaud

unread,
Oct 18, 2012, 8:56:01 AM10/18/12
to Moritz Lenz, perl6-l...@perl.org
On Thu, Oct 18, 2012 at 09:59:21AM +0200, Moritz Lenz wrote:
>
> On 10/18/2012 09:02 AM, Darren Duncan wrote:
> >Something (PyPy et al) got me wondering, is it a goal in the Perl
> >community before too long to have a (compiling) implementation of Perl 6
> >written entirely in Perl 6?
>
> A fair amount of the two major Perl 6 compilers, Rakudo and Niecza,
> are already written in Perl 6.
> Both also contain runtime code written in the "native" underlying
> language (C/C#), and plans to get rid of that are not realistic
> right now.

As a quick data point: Rakudo's codebase (compiler+CORE setting)
currently contains around 4,309 lines of C code (*.c, *.h, *.pmc)
and 24,406 lines of Perl 6 code (*.pm, *.nqp).

So, 85% of Rakudo is written in Perl 6 and 15% in C-ish languages.

Pm
0 new messages