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
Pugs::Compiler::Grammar(3) User Contributed Perl Documentation Pugs::Compiler::Grammar(3)

Pugs::Compiler::Grammar - Compiler for Perl 6 Grammars

    use Pugs::Compiler::Grammar;
    my $grammar = q{
        grammar MyC;

        token def {
            <type> <?ws> <var_list> <?ws>? ';'
        }

        token type { int | float | double | char }

        token var_list {
            <ident>**{1} <?ws>? [ ',' <?ws>? <ident> ]*
        }

        grammar MyVB;

        token def {
            'Dim' <?ws> <MyC.var_list>
            [ <?ws> 'As' <?ws> <MyC.type> ]? <?ws>? ';'
        }
    };
    my $obj = Pugs::Compiler::Grammar->compile($grammar);
    my $perl5 = $obj->perl5;
    eval $perl5; die $@ if $@;
    my $match = MyC->def("float foo;");
    print "type: ", $match->{type}, "\n";
    print "vars: ", $match->{var_list}, "\n";
    $match = MyVB->def("Dim foo, bar;");
    print "vars: ", $match->{'MyC.var_list'}, "\n";

"$obj = Pugs::Compile::Grammar->compile($src)"
Acts as contructor. Accepts a string containing the grammar specs and returns a Pugs::Compiler::Grammar instance.
"$perl5 = $obj->perl5()"
Returns a string containing the Perl source for the grammars compiled.

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

Copyright 2007 by Agent Zhang 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>

compile_p6grammar.pl, Pugs::Compiler::Regex, Pugs::Grammar::Rule, Pugs::Emitter::Grammar::Perl5.
2008-07-29 perl v5.32.1

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

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