cucumber-attic / gherkin2

A fast Gherkin parser in Ragel (The parser behind Cucumber)
MIT License
381 stars 220 forks source link

Create Gherkin BNF #1

Closed msassak closed 15 years ago

msassak commented 15 years ago

A BNF defining Gherkin is desirable for a number of reasons. See the links below for more.

aslakhellesoy commented 15 years ago

Shall we use the .cf format used by http://code.haskell.org/bnfc/ ?

Is there a possibility that we can use bnfc instead of Ragel to obtain the same goals as we have set out for with Ragel? (Speed and portability)

msassak commented 15 years ago

There's no downside I can see to specifying the BNF in the .cf format, but I'm not sure about using bnfc itself as the backend. There's not a lot of information out there about it, including references to its speed, (or not much that I could find with some googling), and it doesn't target Ruby, so that would make development slower. On the other hand, if all we had to produce was a BNF, we might make up a lot of that time. There are some papers about it on the website. I'll dig into those and play around with it and see if I can't learn some more.

aslakhellesoy commented 15 years ago

Remember that we only need Ruby for development purposes. The gem will C or Java for better speed. If we can save development time by writing less code (.cf) maybe that will outweigh the time lost on having to rebuild the C every time we run a spec. Of course, the time to research this also adds time and effort.

As far as speed is concerned - isn't it the speed of the parser generators supported by bnfc that counts?

msassak commented 15 years ago

Yes on all counts. I was thinking of the difference in speed between the C generated by Ragel, by all acounts insanely fast, and that of bnfc, which uses flex and bison behind the scenes, but whatever the case, it's likely an academic concern--both should ought to be significantly faster than Treetop.

msassak commented 15 years ago

I've looked at bnfc a bit, and it seems that using it would be more trouble than it's worth, especially considering how fast the Ragel work is coming along. It produces lex and yacc files like a champ, but these also depend on some code for creating an AST that bnfc produces. As the aim of Gherkin is explicitly not to create an AST, in order to use bnfc we would need to create the scanner and parser generator files, then edit them to remove the references to the AST, etc.

aslakhellesoy commented 15 years ago

Thanks for looking into it Mike. Let's forget about bnfc and just do the BNF by hand in the wiki. It isn't that big anyway.

msassak commented 15 years ago

OK. Closing this ticket then; we've got the BNF page on the wiki.