
Ragel State Machine Compiler - numeromancer
http://www.complang.org/ragel/
======
davidhollander
This seems to have a copy of the HTTP1.1 ragel parser C from Mongrel
<https://github.com/fauna/mongrel/tree/master/ext/http11>

Would be interesting to see how its performance compares to Ry's HTTP parser
from the Node.js library: <https://github.com/ry/http-parser>

~~~
thurston
Ry's is faster. Ragel does pretty good and it gets you most of the way there
when you need something that runs really fast, but it can't beat what a
skilled programmer can do to optimize a parser.

~~~
haberman
> it can't beat what a skilled programmer can do to optimize a parser.

What sorts of clever things does Ry's parser do that Ragel can't figure out?

~~~
thurston
A sure-fire way to beat a Ragel parser is to look ahead several characters and
test the limited possibilities that are present when a language has literal
strings like GET and POST. You can essentially fall back to extremely fast
string searching algorithms in certain places.

Ragel assumes character-by-character parsing and it's difficult to generate
fast code that looks ahead without running into buffer block boundaries. It
could be done though.

You can also use character classes to reduce the number of tests. Ragel
doesn't try to figure those out.

------
drallison
Ruby but no Python. :-(

~~~
thurston
A few people have stopped by the mailing list wondering how much work it would
be to add a python generator. You could send a few motivating words in their
direction to increase the chances of it being worked on.

------
burke
There seems to be a JavaScript target available too:
<https://github.com/dominicmarks/ragel-js>

~~~
thurston
That's not in the trunk yet ... it is queued.

There is also C#. It's been in testing for a while and there are a few known
bugs. Should get worked out in the next release.

------
supersillyus
I think a Go backend was added a while ago, but since there hasn't been a
release in 2009, it isn't part of the official release yet.

~~~
thurston
That's right. That patch is waiting to go out. Unfortunately I didn't get a
release out in 2010. By spring I'm hoping to have one. It got stalled because
I was trying to include a revamp of conditions and I got hung up wrestling
with the complexity of that problem. I now know what I'm dealing with and my
plan is to push out a 6.7 with all the submitted patches, then later on do 7.0
with the new condition stuff. It's gonna be awesome :)

I've also been distracted by another project, which is also going to be
awesome :)

~~~
supersillyus
Awesome. Thanks for the update, and nice work.

