[ragel-users] Any chance of rlcodegen outputting pure-ruby

Adrian Thurston thurs... at cs.queensu.ca
Tue Jan 9 04:06:20 UTC 2007


Hi Matt, it wouldn't be too much work to add a Ruby backend. I can't 
commit much time to it right now (school is very busy). But I'd be happy 
to help out anyone that wants to try it.

I don't know Ruby all that well so there may be issues which crop up. 
Some things to consider:

Table-based parses will be the easiest to port. Start with the generated 
C code (or maybe Java) for some working parser, then port it to Ruby and 
get it working. You should be able to then just rip out the driver code 
and stick it into rlcodegen.

The fastest code generated by Ragel is directly executable. This relies 
on having a goto. A lack of goto is also a problem for Ragel+Java. Colin 
Fleming discussed generating Java byte code directly to get around this 
issue. The same might be an option for Ruby.

Some changes will need to be made to the frontend. Ruby comments and 
literals will need to be supported and the ruby integral types 
represented. I'm currently in the middle of rewriting the Ragel frontend 
parser. When that's done it will be a better time to add a scanner for 
Ruby which can properly separate Ragel code from Ruby code.

Cheers,
  Adrian

Matt Mower wrote:
> 
> Hi,
> 
> I realise that wrapping the C code generated by Ragel into a Ruby
> extension is a reasonably simple exercise but I really think it would
> help with adoption if Ragel could directly generate Ruby source code.
> 
> Is there any likelyhood of that happening? Or does it need someone
> from the Ruby side to pitch in? And how hard might that be?
> 
> Regards,
> 
> Matt
> 



More information about the ragel-users mailing list