Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Parse::RecDescent for simple syntax-directed translation

by tomazos (Deacon)
on Jun 17, 2006 at 15:47 UTC ( [id://555986] : perlquestion . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $start = "eeeeaaaabbbeeee";
    my $end = translate($start);
    # $end eq "eeeeacccdddeeee"  (aaabbb -> cccddd)
    
  2. or download this
    start -> part(s)    { start.t := join ('', part(s).t) }
    
    ...
    AnB -> 'a' AnB 'b'  { AnB.t := 'c' . AnB.t . 'd' }
    AnB -> 'ab'         { AnB.t := 'cd' }