in reply to Re^2: Parse::RecDescent for simple syntax-directed translation
in thread Parse::RecDescent for simple syntax-directed translation
Close. Your grammar strips out all whitespace. Replace
match : part(s) { print join('', @{$item[1]}) }
with
match : <skip:''> part(s) { print join('', @{$item[2]}) }
A slight improvement is to replace
match : <skip:''> part(s) { print join('', @{$item[2]}) }
with
process : <skip:''> part(s) { join('', @{$item[2]}) }
so you can do
$filter = Parse::RecDescent->new($grammar);
print $filter->process('eeeeaaaabbbeeee');
|
|---|