GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PUGS::GRAMMAR::PRECEDENCE (3)

.ds Aq ’

NAME

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

CONTENTS

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:
o grammar => $category_name - the name of this category (a namespace or a Grammar name).

    add_op ()

Instance method. Adds a new operator to the category.

options:
o name => $operator_name - the name of this operator, such as ’+’, ’*’
o name2 => $operator_name - the name of the second operator in an operator pair, such as circumfix [ ’(’, ’)’ ] or ternary [ ’??’, ’!!’ ].



 # precedence=>tighter,
 #   tighter/looser/equiv
 # other=>+,
 # fixity =>
 #  infix/prefix/circumfix/postcircumfix/ternary
 # assoc =>
 #  left/right/non/chain/list
 # rule=>$rule
 #  (is parsed)



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>

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 PUGS::GRAMMAR::PRECEDENCE (3) 2008-07-29

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.