Feature request: Grammar debugging support

2009-05-29 Thread Austin Hastings
I'm using the PGE/PCT tools for working with grammars on Parrot, and I 
have to say that while there's a lot of power, there's very little 
debugging support. What's more, the debugging that is possible seems to 
be parrot debugging --i.e., single-stepping through routines, etc. -- 
instead of grammar debugging.


Given that P6 grammars are at least partially supported in P5, it seems 
like it would pay dividends to insert some sort of debugging mechanism 
at the grammar spec level.


Right now, I'm talking about things like understanding the paths and 
alternations considered by the parser. Why is that rule being executed 
twice? Shouldn't this be a short-name instead of an identifier? Maybe 
this is purely output-oriented, at least for early days, but the ability 
to set some kind of $grammar.trace(1) flag would be a real win.


It may be that there are other useful things to get from the engine than 
rule sequencing. But that's the level I'm operating at right now, and I 
can't think of the other stuff (possibly because all these trees are in 
the way...).


=Austin


Re: Feature request: Grammar debugging support

2009-05-29 Thread Larry Wall
Can't help you with PGE, but STD supports a trace facility by
setting the STD5DEBUG environent variable to -1, or a set of bits
defined in src/perl6/Cursor.pmc in the pugs repo.

Note the log uses ANSI color, so you might want to use less -R
or some such.

Larry


Re: Feature request: Grammar debugging support

2009-05-29 Thread Patrick R. Michaud
On Fri, May 29, 2009 at 11:20:20AM -0700, Larry Wall wrote:
 Can't help you with PGE, but STD supports a trace facility by
 setting the STD5DEBUG environent variable to -1, or a set of bits
 defined in src/perl6/Cursor.pmc in the pugs repo.

I'll look at what STD is using for its traces and see if I can
come up with something similar for PGE.

Pm