Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

fglock (5723)

fglock
  (email not shown publicly)

Journal of fglock (5723)

Monday August 28, 2006
03:58 PM

Pugs::Compiler::Rule and Pugs

[ #30782 ]

audreyt is considering using Pugs::Compiler::Rule as an alternate Rules library for Pugs, in addition to PGE.

audreyt and PerlJam suggested porting Rules to PCRE, which would let us bootstrap anywhere we can find PCRE (php, python, java, etc).

an alternative would be to implement P::C::R in plain Perl6, which is straightforward (and mostly done - see http://svn.openfoundry.org/pugs/v6/v6.pm/lib/Pugs/Grammar/P6P6Rule.pm),
or even, to port P::C::R to C (libp6re would require that the callback handlers be rewritten in C instead of Hs/P6/P5).

Thursday August 24, 2006
02:00 PM

towards a Pure-Perl6 v6.pm

The v6.pm module Pugs::Grammar::Term has been ported to Perl6 and it successfully replaces the Perl5 version.

lib/Pugs/Grammar/P6Term.pm

The circularity is handled by a .pmc file, which will be distributed together with the Perl6 source code.

Tuesday August 15, 2006
05:05 PM

Pugs::Runtime::Value is under way

Pugs::Runtime::Value is v6.pm version of Perl6::Value and Perl6::Container, which were used in the PIL-Run project.

Instead of Perl6::MetaModel, Pugs::Runtime::Value uses the Perl 6 object system through 'use v6' - Pugs::Runtime::Value is pure-p6, except for very low-level stuff. Circularity - Yay!

http://svn.openfoundry.org/pugs/perl5/Pugs-Runtime-Value/

Wednesday July 19, 2006
12:17 AM

Pugs::Compiler::Rule refactoring

Pugs::Compiler::Rule has been branched in the svn repository in order to fix some architecture problems:

- the bootstrapped compiler and the user-side runtime will no longer be shared. This will make it easier to make changes in the user-side, without needing to redo the bootstrap.

- there will be a single Match class - currently :ratchet and non-ratchet rules create different match objects. The unification will fix the long due TODO of allowing calls between ratchet and non-ratchet rules.

Today Audrey also contributed a change in the Match class, allowing '$($/)' to return the result object - this syntax is the long form of '$/()'.

Wednesday July 05, 2006
11:06 PM

v6.pm rules

v6.pm now has rule declarations. It still needs some additional work to process parameters, etc. Then v6 will be able to compile it's own grammar, and maybe it will be entirely rewritten in P6 (except for the runtime modules).

Unfortunately, the build is currently broken in windows and osx - at least for unexperienced users, it seems. I'm planning to add eval() around the required binary modules, so that at least a subset of the language can work without XS compilation.

Friday June 30, 2006
02:09 PM

my first v6.pm program to use a module in v6.pm!

I added the first OO test to v6.pm This is also the first v6.pm program to use a module written with v6.pm:

    # file: t/10-moose1.t
    use v6-pugs;

    use lib './t', '.';
    use moose1;

    say '1..1';
    say '1 ok # use Moose';

and the module:

    # file: t/moose1.pm
    use v6-pugs;
    class Point;

    has $.x is rw; # instance attributes
    has $.y; # default "is readonly"

    method clear () {
        $.x = 0; # accessible within the class
        $.y = 0;
    }

Very simple, isn't it? The second file was copied from audreyt's slides in YAPC::NA.

The files compile to:

  # generated file: t/10-moose1.tc
  use Pugs::Runtime::Perl6;
  use strict;
  no warnings 'void';
  use lib( './t', '.' );
  use moose1();
  print '', '1..1';
  print "\n";
  print '', '1 ok # use Moose';
  print "\n";
  1;

and:

  # generated file: t/moose1.pmc
  #
  # [... checksum header removed ...]
  #
  use Pugs::Runtime::Perl6;
  use strict;
  no warnings 'void';

  package Point;
  use Moose;
  use Exporter 'import';
  our @EXPORT;
  has 'x' => ( 'is' => 'rw' );
  has 'y' => ();

  sub clear {
        my $self = shift;
        {
                $self->{'x'} = 0;
                $self->y(0)
        }

  }
  1;

This is in the development version of v6.pm - not in CPAN yet.

Saturday June 24, 2006
10:39 PM

more v6

I'm preparing v6.pm for release with next version of Pugs. I'm taking care this time, so that people don't think it's a complete implementation - it's not at all.

There are quite a few problems ahead:

- the compiler is currently slow to load - this is fixable, but it takes some work.

- integrating P6 syntax in Pugs::Compiler::Rule will create a circular dependency with v6.pm

- v6 needs support for multis (multisub, multimethod), types, advanced OO (the plan is to use Stevan's Moose.pm), coroutines, and all the P6 goodies that are not native to P5.

v6.pm is mostly about syntax - all the semantics must be provided by external modules.

About the old 'lrep' script - I think I'll rewrite it as a thin v6.pm wrapper, just because I find it a cool name.

Tuesday June 20, 2006
08:39 AM

use v6-pugs

Today I plan to rename Pugs-Grammar-Perl6 to Pugs-Compiler-Perl6, and start adding the glue code to make it work.

The first goal is to allow perl 5 to execute this:

    use v6-pugs;
    "hello, world".say;

This should either execute immediately, if called with '-e', or create a .pmc file containing:

    print "hello, world", "\n";

url: http://svn.openfoundry.org/pugs/misc/pX/Common/

The same code could be compiled to use Inline::C instead of plain perl.

update: the module is now called 'P6.pm', because 'v6' didn't work in perl 5.

update 2: the module is finally named 'v6.pm', but it is used 'v6-pugs' - and it works fine - thanks Audrey!