Flávio Soibelmann Glock > Pugs-Compiler-Rule > Pugs::Grammar::Precedence

Download:
Pugs-Compiler-Rule-0.37.tar.gz

Annotate this POD

CPAN RT

New  2
Open  0
Stalled  1
View/Report Bugs
Source  

NAME ^

Pugs::Grammar::Precedence - Engine for Perl 6 Rule operator precedence

SYNOPSIS ^

  use Pugs::Grammar::Precedence;

  # example definition for "sub rxinfix:<|> ..."

  my $rxinfix = Pugs::Grammar::Precedence->new(
    grammar => 'rxinfix',
  );
  $rxinfix->add_op(
    name => '|',
    assoc => 'left',
    fixity => 'infix',
  );

Pseudo-code for usage inside a grammar:

    sub new_proto( $match ) {
        return ${$match<category>}.add_op(
            name => $match<name>,
            fixity => ...,
            precedence => ...,
        );
    }

    rule prototype {
        proto <category>:<name> <options>
        {
            return new_proto($/);
        }
    }

    rule statement {
        <category.parse> ...
    }

DESCRIPTION ^

This module provides an implementation for Perl 6 operator precedence.

METHODS ^

new ()

Class method. Returns a category object.

options:

add_op ()

Instance method. Adds a new operator to the category.

options:

AUTHORS ^

The Pugs Team <perl6-compiler@perl.org>.

SEE ALSO ^

Summary of Perl 6 Operators: http://dev.perl.org/perl6/doc/design/syn/S03.html

COPYRIGHT ^

Copyright 2006, 2007 by Flavio Soibelmann Glock and others.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html

syntax highlighting: