Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by ikegami (Patriarch)
on Jun 20, 2006 at 23:52 UTC ( #556547=note: print w/replies, xml ) Need Help??


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');

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://556547]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2023-10-04 17:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?