Hi Dotan,

Glad to hear that parslet is working fine for you!

> Secondly, is there _any_ way to use treetop grammars with parslet? what I
> turned to do was a mechanic search + replace of my treetop grammar plus
> minor hand tweaks. immediately I was wondering about that.
>
> When I finished, I realized I had two versions of the parser written with
> both treetop and parslet. As a typical engineer I ran a quick benchmark --
> and parslet (1.2.0) was faster by a considerable margin (perhaps i'll post
> the results further down the week).

I would love to see the benchmark and the results. Here are mine ;) 
http://blog.absurd.li/2011/02/02/parslet_and_its_friends.html (Somewhat 
old, but still valid. Misleading X axis, all my fault)

Like Jason mentioned, Parslet has the experimental foreign expression 
parse feature; one of the things that didn't convince me completely 
after I had built it. It's still in there, although somewhat unfinished; 
have a look at expression_spec.rb and the 'exp' method. For example:

    exp("'a' 'b')

will be equal to

   str('a') >> str('b')

I mostly use it to round-trip test the #inspect method of all parslet 
atoms. It doesn't do a lot of things Treetop grammars do, like 
predicates and .. of course action blocks. But its a start.

Parslet exports (on the other hand) neatly to citrus and treetop - 
although it beats me why you would ever want to leave us, we're so 
friendly ;)

Likewise, I think it would probably be easier to extend Treetop with 
parslet output than it is to built another treetop parser. And there is 
the matter of the small incompatibilities/ the opinionated bits about 
parslet that don't fit Treetop exactly.

So no, no direct conversion now, and probably never. Its just too easy 
to rebuild parsers; plus - most of the treetop code I've seen isn't 
tested, something I heavily recommend.

best regards,
kaspar


Reply via email to