[ragel-users] Re: Ruby and Java code generation

Adrian Thurston thurs... at cs.queensu.ca
Wed Oct 3 17:15:33 UTC 2007

Update: I just checked in a new driver for Ruby. Ruby code generation is
now also current. Gotos are emulated using a series of if statements.


Adrian Thurston wrote:
> I just checked-in a java driver that uses a switch statement in place of
> gotos. Indeed it works well. Java code generation is now current.
> -Adrian
> Erich Ocean wrote:
>> Adrian,
>> Duff's device can be used with Java, so you might be able to use that  
>> technique to jump back into the middle of the processing loop.
>> See http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html for  
>> an example.
>> Best, Erich
>> On Sep 28, 2007, at 3:23 PM, Adrian Thurston wrote:
>>> Hi,
>>> What is now needed in Ruby and Java code is a jump back into the
>>> processing loop just like that found at rlgen-cd/tabcodegen.cpp:1041.
>>> -Adrian
>>> Adrian Thurston wrote:
>>>> Before loop breaks and variables were used in Ruby code call/cc  
>>>> features
>>>> were used. This was found to be very slow (about 10 times slower than
>>>> the current). Do you think throw/catch would be any better than  
>>>> call/cc?
>>>> Later today I'm going to commit my work on the C version. I'll  
>>>> highlight
>>>> the part that is troublesome and maybe someone that knows Java and  
>>>> Ruby
>>>> well can suggest something.
>>>> Adrian
>>>> Ryan King wrote:
>>>>> On Sep 28, 2007, at 12:02 PM, Adrian Thurston wrote:
>>>>>> Hi,
>>>>>> I'm having some trouble with Ruby and Java code generation as I
>>>>>> implement 6.0 features. The main problem with targeting both of  
>>>>>> these
>>>>>> languages is the lack of goto statement. This is problematic  
>>>>>> even for
>>>>>> the table-driven machine. There are a number of places in the  
>>>>>> driver
>>>>>> where a jump in or jump out of the processing loop is required.  
>>>>>> So far
>>>>>> I've gotten away with using named loops in Java and control flow
>>>>>> variables in Ruby, however with the latest changes things are  
>>>>>> getting
>>>>>> really ugly. I don't have a solution yet. I'm not sure what to do
>>>>>> right
>>>>>> now, so for the time being I will continue ahead with the 6.0  
>>>>>> features
>>>>>> and stall work on Ruby and Java code generation.
>>>>> You can emulate GOTO-ish behavior in ruby with throw and catch:
>>>>> catch(:foo) do
>>>>>   ...
>>>>>   throw(:foo)
>>>>>   ...
>>>>> end
>>>>> There are limits to how the code can be structured in these cases  
>>>>> (in
>>>>> blocks).
>>>>> -ryan
>> --~--~---------~--~----~------------~-------~--~----~
>> You received this message because you are subscribed to the Google Groups "ragel-users" group.
>> To post to this group, send email to ragel-users at googlegroups.com
>> To unsubscribe from this group, send email to ragel-users-unsubscribe at googlegroups.com
>> For more options, visit this group at http://groups.google.com/group/ragel-users?hl=en
>> -~----------~----~----~----~------~----~------~--~---

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20071003/ce37f4c7/attachment-0001.sig>

More information about the ragel-users mailing list