Perl 6 Compiler Design and Implementation of the Perl 6 Compiler #14

Parrot interface to PGE

PGE is part of the Parrot distribution, and is compiled into bytecode when Parrot is built.

To use PGE from parrot, execute:

.local pmc p6rule
load_bytecode "PGE.pbc"
p6rule = find_global "PGE", "p6rule"

To compile a regular expression, simply call the p6rule compiler:

$P0 = p6rule(":w From\: (\N*) To\: (\N*)")

$P0 then holds a subroutine pmc that matches strings against the given rule and returns a PGE::Match pmc:

$P1 = $P0("From: pmichaud@pobox.com\nTo: larry@wall.org")
Copyright © 2005 Patrick R. Michaud