Ken Fox wrote:
> Excellent. Will there be an abstract syntax for tree
> rewriting or is it Perl 6 all the way down?
I'd expect it to be Perl all the way down. Though a
tree rewriting module might make it seem abstract. ;-)
> This is really amazing stuff. I was expecting some
> support for
Damian Conway wrote:
> I would imagine that modifiers would be passed some
> kind of hierarchical representation of the rule
> they're modifying (i.e. a parse tree of it), and
> would be expected to manipulate that structure
> representation.
Excellent. Will there be an abstract syntax for tree
r
Ken Fox wrote:
> I'm messing around with regex code generation by
> converting first to a grammar. The modifiers seem
> to need intimate knowledge of regex -> grammar
> conversion. This may be a quirk of my approach.
> People using tree traversal or generating code
> directly from the regex might
Damian Conway wrote:
> One possibility is that a modifier is
> implemented via a special class:
>
> my class Decomment is RULE::Modifier
>is invoked(:decomment) {
> method SETUP ($data, $rule) {
> ...
> }
> # etc.
>
Ken Fox wrote:
> The thing I'd like to do right now is turn on :w
> for all rules. A Fortran grammar might want to turn
> on :i for all rules.
>
> Maybe add modifiers to the grammar declaration?
>
> grammar Fortran :i { ... }
Maybe. Or a property:
grammar Fortran is modified(:i) { ...
The thing I'd like to do right now is turn on :w
for all rules. A Fortran grammar might want to turn
on :i for all rules.
Maybe add modifiers to the grammar declaration?
grammar Fortran :i { ... }
It would also be convenient to allow the :w
modifier to have lexically scoped behavior so a
gra