Pugs::Emitter::Grammar::Perl5 - Perl 5 emitter for grammar ASTs
use Pugs::Compiler::Grammar;
use Pugs::Emitter::Grammar::Perl5;
my $ast = Pugs::Grammar::Rule->grammar(q{
grammar MyLang;
token def {
<type> <?ws> <var_list> <?ws>? ';'
}
token type { int | float | double | char }
token var_list { <ident> <?ws>? [ ',' <?ws>? <ident> ]* }
})->();
my $perl5 = Pugs::Emitter::Grammar::Perl5::emit($ast);
print $perl5;
- "$perl5 = Pugs::Emitter::Grammar::Perl5::emit($ast)"
- Generate Perl 5 source code from the grammar AST returned by
Pugs::Grammar::Rule's grammar parser.
The Pugs contributors <perl6-compiler@perl.org>.
Copyright (c) 2007 by Agent Zhang (<agentzh@agentzh.org>) 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>
Pugs::Compiler::Grammar, compile_p6grammar.pl.