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

Adrian Thurston thurs... at cs.queensu.ca
Wed Jan 10 23:26:49 UTC 2007


Cool! I'll have a look at this ASAP. 5.17 is going to be just a parser
rewrite release but after that I'll add this work in.

Cheers,
 Adrian

Victor Hugo Borja wrote:
> Matt,
> 
> I'm also interested on getting Ragel to output ruby, today I've been
> working on this.
> Following Adrian's advice, I decided to start by porting a simple
> generated parser from c to ruby.
> Once the ruby parser was working as expected (used continuations
> instead of c' gotos), I started to work on the backend for ragel,
> code generation is working now (with awful code indentation atm). the
> generated parsers are still somewhat buggy, so I'd appreciate if anyone
> could help with tests  for this.
> 
> my work up to now is on http://vic.selfip.com/pub/ragel-5.16-rb.tar.gz,
> check the rbtmp directory if you want to see the ported parser.
> 
> I expect to have some time this weekend to fix the generated parsers,
> and commit a working patch to Adrian.
> 
> Cheers,
> --
> Victor Hugo Borja.
> v... at rubyforge.org
> 
> On Jan 8, 10:06 pm, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
>> 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