kschiess / parslet

A small PEG based parser library. See the Hacking page in the Wiki as well.
kschiess.github.com/parslet
MIT License
805 stars 95 forks source link

accelerator must match to 'simple' rule? #128

Closed ytti closed 9 years ago

ytti commented 9 years ago

https://github.com/ytti/sapluuna/blob/master/lib/sapluuna/parser.rb#L20

To do this in accelerator, I can't obviously type in the rule as-is, as the methods are not available in accelerator context.

Is the only way to use accelerator to turn the original rules into simple rules which only match to strings?

Eating this: [saytt@clara ~]% wc /tmp/dna.junos 1357 3142 36075 /tmp/dna.junos

With reasonable macihnes takes 15s. Using my own ghetto (not fair comparison) parser takes <100ms. I understand that performance isn't goal for parslet. And I accept that as answer. I'm just curious if I'm understanding acceleration correctly.

kschiess commented 9 years ago

Accelerators can be used to replace parts of your parser with other, faster bits. They are at the moment in an experimental stage and can't for now be applied across rule barriers.

So I am guessing the answer to the question in what you write is: 'No, accelerators are not limited the way you describe' - but I must admit, I don't really understand what you need of me. Is this a bug report? Why is this not going to the mailing list? What are you trying to achieve?