Patrick,
What you've done works really well! I like the way that things have really come together (especially the way that the compiler interface works).
Two little quirks: In demo.pir. glob seems be having a problem with Returns:
pge $ ../../parrot demo.pir
input "rule <pattern>", "glob <pattern>", "pir", target string, "trace", or "next" trace Tracing for new patterns is now on
input "rule <pattern>", "glob <pattern>", "pir", target string, "trace", or "next" glob fred
input "rule <pattern>", "glob <pattern>", "pir", target string, "trace", or "next" fred "fred\n" <1> fail match failed
I would have thought that it general the trailing Return should be chopped off before being passed into the compile, although p5re_compile certainly copes with it, so perhaps so should glob.
I know that it's still early days for the harness, but you get a Null PMC if you haven't supplied a rule before a string to match, and if you enter rule without a pattern you get "Label 'R3' is already defined". (I know that in the grand scheme of things these are low down on your list!)
I may get a mo to supply a patch for these if you like...
Well done!
Nick
Patrick R. Michaud wrote:
As of a few minutes ago, the "Perl 6 Grammar Engine" has been renamed to the "Parrot/Perl Grammar Engine" (PGE). All of the associated files and symbols have been likewise renamed, and some things have been moved around to more closely follow Parrot guidelines.
The README file in compilers/pge has been updated as well, and it tries to explain most of what needs to be known to work with PGE.
Some of the highlights of recent changes:
- To load PGE into the Parrot interpreter, use
load_bytecode "library/PGE.pir"
- PGE subroutines and modules now live in the "PGE" namespace.
- Several pattern-matching language compilers are provided with PGE:
"p6rule" - Perl 6 rules syntax "glob" - Wildcard globs ( ? = any single character, * = 0+ chars ) "p5re" - Perl 5 regular expression syntax
All of these are still "under development". To access one of these compilers:
.local pmc p6rule_compile find_global p6rule_compile, "PGE", "p6rule"
- The beginnings of a test suite are in t/p6rules. More tests
are greatly desired -- please feel free to contribute some! Good sources for test ideas are the existing test suites in Perl 5, Damian's Perl6::Rules, etc.
- The :, ::, and ::: backtracking operators have been implemented (but need more testing).
- The demo.pir program is a bit more robust, and allows patterns in p6rule, glob, or p5 syntax to be entered.
- PGE now includes a "trace execution" option so that we can see the steps being performed during a match. Hopefully this will be useful in identifying and evaluating potential optimizations for the engine. (Yes, it also shows that some parts of the engine are not as efficient as they could be--we'll get there soon!)
Questions, comments, suggestions can be sent to [EMAIL PROTECTED]
Thanks!
Pm