changes to ragel, feedback requested

Adrian Thurston thurs... at
Tue Mar 13 16:44:18 UTC 2007

Hi all,

I have made some changes which I'd like to mention here in case anybody
would like to discuss them.

There are two basic changes.

1. All machine instantiations (using ":=") now have a corresponding entry
point generated in the output code. This can be used to initialize cs to
something other than main.

2. The definition of the main machine is now optional. If it is not given
then the start state is not generated and cs is not initialized by the write
init statement.

The idea is that I want to be able to do this:

    machine foo;

    main_v1 := ...;
    main_v2 := ...;
int cs = (some_test)? foo_en_main_v1 : foo_en_main_v2;
%% write init;

I like this, but it has an implication that I'm worried about. If you
mis-spell main or otherwise forget to add it without realizing, then CS will
never be initialized and undefined behaviour will occur.

    machine foo;
    this_should_be_main := ...;
// cs won't get initialized here
int cs;
%% write init;

What do you think? Do we say too bad for you ... or do we find some other
way? Any feedback would be appreciated.


More information about the ragel-users mailing list