[ragel-users] Ruby and Java code generation

Ryan King ryansk... at gmail.com
Fri Sep 28 19:41:27 UTC 2007


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



More information about the ragel-users mailing list