Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Parse::RecDescent for simple syntax-directed translation

by Limbic~Region (Chancellor)
on Jun 18, 2006 at 15:16 UTC ( [id://556097] : note . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $str = "eeeeaaaabbbeeee";
    $str =~ s/((a+)(??{'b'x length$2}))/'c' x (length($1) * .5) . 'd' x (l
    +ength($1) * .5)/e;
    
  2. or download this
    #!/usr/bin/perl
    use strict;
    ...
    };
    my $parser = Parse::RecDescent->new($grammar);
    $parser->match('sing aaaaaabbb song');