when to use PEP treetop vs regexp

D

David Rose

on a practical basis when would want to use treetop parse over using
regular expressions with .scan()? ....
in the wicki 'treetop (PEP)' subject/submission.... it would seem
that using regular expression would be a better tool!
 
P

Phrogz

on a practical basis when would want to use treetop parse over using
regular expressions with .scan()? ....
in the wicki 'treetop (PEP)' subject/submission.... it would seem
that using regular expression would be a better tool!

I don't have enough experience to be sure, but my guess is:
1) If you can't do it in Regexp (e.g. recursive nested parens), use
something like Treetop.
2) If the overall solution using Regexp alone becomes too large or
unmaintainable (which may be the same thing), use something like
Treetop. (Or you're laying a foundation that you think may become
large in the future.)
3) Otherwise, Regexp will be less overhead and, I suspect (but don't
know yet) faster.

I'm currently porting my OWLScribble[1] library from using (my own
strscan/regex state-based) TagTreeScanner[2] parser to use Treetop
instead. My goal is to learn Treetop, create a more readable and
maintainable syntax description, and also to be able to benchmark and
compare the performance of the two implementations.

[1] http://rubyforge.org/projects/owlscribble/
[2] http://rubyforge.org/projects/tagtreescanner/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top