On 1/21/06, Rob Kinyon <[EMAIL PROTECTED]> wrote:
> I'm making a few assumptions here:
>     1) Since PGE isn't part of Perl6 (because it's written in PIR), it
> can be used as the parser/lexer/etc. for any language, not just Perl6.

Rules, like regexes, are essentially language neutral. So that's true.

>     2) Since PGE can be lexically-scoped, one can change the entire
> grammar within a given block, including how variables are referenced,
> subroutines are called, etc.

The grammar only governs the surface syntax. It does not automagically
control semantics (e.g. whether .arguments are available, tying, blessing,
et cetera).

Moreover, writing a Perl 5 parser in PGE alone is... Very difficult.
It can be done (eg. PPI), but taking it and emit PIR is a nontrivial
task that would not magically happen.

>     3) Since everything is, at the heart, just a PMC, so long as the
> appropriate PIR is emitted, it doesn't matter how the userside code is
> written so long as the right parser/lexer/whatever is used to
> translate it to PIR.

Again, that'd be handwaving, as Perl5->PIR compiler is currently
not championed by anybody.  The slightly less ambitious Perl5->PMCs
project (Ponie) is also in need of a champion at this moment, and
it does not guarantee sane interoperation with other PIR targetting
compilers in itself, though we are certainly working on it.

> So, if all three assumptions hold, then your monolithic Perl5 script
> can easily inline any Parrot-targeted language you want, simply by
> doing the following:
>     1) Use Ponie.
>     2) Within a block, import the appropriate PGE module(s) to
> redefine the grammar to P6 and do what you need to do.
> No translator needed.

The amount of effort of writing all this is no less heavy than that of a
Perl5-to-Perl6 translator. :-)  Also it makes sense to have multiple
migration paths (runtime-level, bytecode-rewriting-level, source
recompilation level), because different people are interested in different

The P5-to-P6 translator also could work when targetting the JavaScript
runtime, or the CLR runtime, or generating native code via LLVM or D;
in those places Ponie does not help at all.


Reply via email to