Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > when to use PEP treetop vs regexp

Reply
Thread Tools

when to use PEP treetop vs regexp

 
 
David Rose
Guest
Posts: n/a
 
      01-28-2008
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!
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Phrogz
Guest
Posts: n/a
 
      01-28-2008
On Jan 28, 8:27 am, David Rose <bitdo...@yahoo.com> wrote:
> 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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[regexp] How to convert string "/regexp/i" to /regexp/i - ? Joao Silva Ruby 16 08-21-2009 05:52 PM
Treetop parser (or PEG in general?) questions Phrogz Ruby 18 04-22-2008 08:05 PM
Treetop Email Parser Phrogz Ruby 13 02-01-2008 05:12 AM
About Rational Number (PEP 239/PEP 240) Lie Python 25 12-18-2007 06:13 AM
PEP for new modules (I read PEP 2) Christoph Becker-Freyseng Python 3 01-16-2004 04:26 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57