Charles Oliver Nutter wrote:
> Brian Adkins wrote:
>> On Oct 28, 2:45 am, Charles Oliver Nutter <charles.nut... / sun.com>
>> wrote:
>>> JRuby runs Rake, RubyGems, Rails, Mongrel, and nearly all pure-Ruby
>>> libraries and apps that are out there. Compatibility has gotten closer
>>> and closer to 100% over the past year.
>> I thought Mongrel was a Ruby / C hybrid. How does this run on JRuby -
>> using JNI?
> Only a small portion of Mongrel is written in C; those bits have been 
> ported, and an upcoming release of Mongrel will have a JRuby 
> platform-specific gem available.

To be more precise: the Mongrel HTTP parser is actually written in
Ragel (<http://WWW.CS.QueensU.Ca/~thurston/ragel/>), *not* in pure C.
Ragel is a DSL (or a compiler, depending on from which side you look)
for writing Finite State Machines for parsers. So, the main part is
actually the Ragel DSL and only the (small) embedded actions are
written in C. The nice thing is that Ragel actually has multiple
backends, so it can not only compile to C, but to Java as well. So,
just by recompiling the Ragel source to Java, you can get the whole
State Machine scaffolding set up and only need to port the embedded
actions.

Interestingly, Ragel also has a Ruby backend: can you say
"Mongrelinius"?

BTW: Hpricot also uses Ragel, and it also has already been ported to
JRuby. (Other Ruby projects that use Ragel: RFuzz, SuperRedCloth, json
and LEL (from the JRuby Swing builder called Profligacy).)

jwm