Hacker News new | past | comments | ask | show | jobs | submit login
Ragel State Machine Compiler (complang.org)
39 points by numeromancer on Feb 19, 2011 | hide | past | favorite | 15 comments



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


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.


> 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?


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.


It's super-fast.


That's not a comparison and your pronoun's reference is ambiguous.


I'm 50 years old, and I get confused by "its" vs "it's" from time to time. So one of my bookmarked pages is: http://garyes.stormloader.com/its.html


I don't think he was commenting on his usage of "its" vs. "it's" (which is actually correct), but rather that it's ambiguous which item "it" is referring to -- Ragel or Ry's.


Ruby but no Python. :-(


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.


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


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.


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.


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 :)


Awesome. Thanks for the update, and nice work.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: