[ragel-users] State chart style and entering actions

Adrian Thurston thurston at complang.org
Wed Sep 14 05:34:39 UTC 2011


Hi Shawn, does this work for you?

A = (
    start: A: (
        IDLE -> A |
        POLL @poll OPEN -> A |
        POLL @poll CLOSED -> B
    ),
    B: (IDLE -> B | EXIT -> final)
) >a_entry;

m := START A;

-Adrian

On 11-07-27 08:00 AM, Shawn Hoover wrote:
> Hello,
>
> I'm using the state chart style for processing application logic. So far
> I've gotten by with finishing actions attached to specific events, but
> now I'd like to use an entering action for an entire labeled expression.
> Here's an example:
>
> machine := (
> start: START -> A,
> A: (IDLE -> A |
>     POLL @poll OPEN -> A |
>     POLL @poll CLOSED -> B), >~a_entry,
> B: (IDLE -> B |
>     EXIT -> final)
> );
>
> I would like to execute a_entry once and only once when the A "loop" is
> entered. It does execute on entrance, but then it also executes every
> time I get IDLE or POLL OPEN.
>
> Is there a way to make a_entry execute only once while still using state
> charts and the union operator in the same structure? I suppose the
> following would work:
>
> A: (IDLE | POLL @poll OPEN)* POLL @poll CLOSED -> B >~a_entry;
>
> But I'd like to retain the original structure if there's a better way to
> attach the action.
>
> Thanks,
> Shawn
>
>
>
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users

_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users



More information about the ragel-users mailing list