Discussion:
[ragel-users] Extending machines
Karel Sedláček
2012-11-17 21:04:35 UTC
Permalink
For the purposes of code modularization, it would be very desirable to
be able to do two things:
- redefine (override) machine definitions
- attach actions to definitions separately from their original
definition and without overriding said original definition

Supposing that the former would be implemented such that a
redefinition could reference its previous definition, the latter is
natural; e.g.

%%{
machine ex;

action from_a {
printf("got an A\n");
}

a = ('a');
a = (super | 'A') %from_a;
}%%

Perhaps this is a more moderate proposal to
http://www.complang.org/pipermail/ragel-users/2008-July/001960.html
which would solve some of the same problems. It is also pretty nice
for being able to modularize your Ragel machines out of your code,
providing the base machine separately and overriding parts piecemeal
or attaching transition actions to your code as necessary.

k
Adrian Thurston
2012-12-09 17:06:54 UTC
Permalink
Hi Karel, thanks for the suggestion. I'll keep this in consideration.

-Adrian
Post by Karel Sedláček
For the purposes of code modularization, it would be very desirable to
- redefine (override) machine definitions
- attach actions to definitions separately from their original
definition and without overriding said original definition
Supposing that the former would be implemented such that a
redefinition could reference its previous definition, the latter is
natural; e.g.
%%{
machine ex;
action from_a {
printf("got an A\n");
}
a = ('a');
a = (super | 'A') %from_a;
}%%
Perhaps this is a more moderate proposal to
http://www.complang.org/pipermail/ragel-users/2008-July/001960.html
which would solve some of the same problems. It is also pretty nice
for being able to modularize your Ragel machines out of your code,
providing the base machine separately and overriding parts piecemeal
or attaching transition actions to your code as necessary.
k
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
Loading...