IIRC there was a commit that indicated that the generated code is faster than hand-written code. They started with a hand-written lexer. Also, Ninja is very performance sensitive, e.g. they optimized the heck out of it for incremental builds, which involves parsing big auto-generated Ninja files.
I looked at the code and I liked how it was written, so I modelled the original Oil lexer in C++ after it.
Looking at Ragel now, it looks very similar to Ninja. The applications seem to be more network-oriented than programming language-oriented, but I don’t think that’s fundamental.
re2c can also execute semantic actions in the host language with {} when it matches a regex. So they look very similar to me.
However the latest I heard about Ragel is that it was involved in Cloudbleed, though perhaps not at fault. I think there is an API design issue. And also it seems to be somewhat commercial and developed by a single person company?
Did you consider using Ragel and decide
re2c
was better? Curious to hear your comparisons if so.Good question, although I don’t have a great answer.
I didn’t really consider Ragel. I had heard about it a long time ago reading Zed Shaw’s posts about its use parsing HTTP in the Mongrel web server.
It didn’t really cross my mind when thinking about Oil. I encountered re2c in the lexer for the Ninja build system:
https://github.com/ninja-build/ninja/blob/master/src/lexer.in.cc
IIRC there was a commit that indicated that the generated code is faster than hand-written code. They started with a hand-written lexer. Also, Ninja is very performance sensitive, e.g. they optimized the heck out of it for incremental builds, which involves parsing big auto-generated Ninja files.
I looked at the code and I liked how it was written, so I modelled the original Oil lexer in C++ after it.
Looking at Ragel now, it looks very similar to Ninja. The applications seem to be more network-oriented than programming language-oriented, but I don’t think that’s fundamental.
re2c can also execute semantic actions in the host language with
{}
when it matches a regex. So they look very similar to me.However the latest I heard about Ragel is that it was involved in Cloudbleed, though perhaps not at fault. I think there is an API design issue. And also it seems to be somewhat commercial and developed by a single person company?
http://www.colm.net/news/
I don’t feel a need to look into Ragel more, since I already have working re2c code, but I’m definitely interested if anyone else has experience.
FWIW I read this paper on re2c, although I believe it’s changed a lot in the last 25 years!
http://re2c.org/1994_bumbulis_cowan_re2c_a_more_versatile_scanner_generator.pdf
Also, on the re2c website, it says PHP uses it… but I haven’t looked at the code to see where.
ragel is good software, it has had some history of being closed off, then reopened as the maintainer tried to find a good way to profit from his work.
The cloud bleed problem wasn’t really ragel’s fault, but the maintainer made a patch regardless to make it even less likely.