Thanks for the answers guys! I think the fact that Parslet can understand Treetop grammar is excellent (which is my first question).
it may have been a language barrier - but i wasn't looking for a way to convert Parslet to Treetop :) what i was intending to ask is that i was wondering about what are the benefit of generating code (treetop) vs keeping it in memory (parslet) regarding the code for the parser - unfortunately i can't put it out, but it is a parallel of a log / machine output parser - very simple. I'll try to abstract out the details and publish something about it and benchmarks towards weekend thanks again! :) On Tue, Apr 26, 2011 at 4:56 PM, Kaspar Schiess <[email protected]> wrote: > 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 > > >
