for 6.0: going back to 3.X semantics for >, %, err

Adrian Thurston thurs... at
Tue Oct 9 22:48:05 UTC 2007


In version 3 of Ragel the semantics of >, % and the error actions were

1. The leaving operator '%' would also embed the action as an EOF action
if the final states of the machine it was applied to remained final in
the compiled machine. This meant that as long as the machine didn't
error, the leaving action would always be executed even if it came right
at the end of the input.

2. The starting transition operator '>' would embed a leaving action
into the start state if the start state was final. This meant that if a
machine accepted the zero-length string and control passed through the
zero-length string then the starting transition action would still get

3. All global and local error actions would be executed when the input
ended in a non-final state (and the error action was embedded into that

This semantics meant a single action block could be executed on a
regular character transition and on an EOF event. The problem was that
regular actions were generated in the main processing loop using 'write
exec' and EOF actions were generated using 'write eof'. This often led
to compile errors because the context was not the same. You could fix
the compile errors by providing dummy variables to the EOF code, but
there would be no effect in the EOF code.

This inconsistency seemed to drive up the complexity of these operators
and in the 4.0 line I decided to simplify the operators by eliminating
the above action embedding behaviour.

In the 6.0 release I will be bringing this behaviour back. Now that EOF
actions are written in the main processing loop, they have available to
them everything that regular actions have and the original problem is gone.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the ragel-users mailing list