[ragel-users] Re: runaway action

Adrian Thurston thurs... at cs.queensu.ca
Sun Aug 10 17:52:11 UTC 2008

On Fri, 8 Aug 2008, Manfred_Nowak wrote:

> The ragel source is in the second post, except, that the closing curly
> bracket is dropped somehow. Please insert '}' at the end of the ragel
> source.

Sorry! I tried to move a little too fast.

The -> operator produces an epsilon transition, which is removed
when ragel converts from an NFA to a DFA. It does not produce a
transition in the resulting machine. The transition comes from whatever is
in front of the epsilon operator. In the case of ''-> there is just a
single state and also no real transition. That combination effectively
merges the single state of '' with the target of the epsilon transition.

The from(a) and to(a) operators apply only to physical transitions
leaving from or entering into a state, which I think is the reason why you
are not getting the desired results.

Also note that the | opertor is not exclusive. I noticed you had
expressions like:

'a' ->l1 |
any ->l2

The second line of the above will take you to l1 and l2 on 'a' and to l2
on anything else.


> If you save the source as "fsm.rl", then the commands
>   ragel -D fsm.rl
>   dmd  fsm
>   fsm <arg>
> should be ececutable, where <arg> should be replaced by arguments like
> `aa' , `bc' or `bca'.
> In the source the action `clr' is defined but not used. The goal is to
> attribute the FSM in such a way, that whenever the start state is
> entered a `clr' action is executed. Because the `clr' action simply
> writes the string "clr", this means that:
> `fsm aa' should produce 2 times "clr",
> `fsm bc' should prdouce 1 "clr" and
> `fsm bca' should produce 2 times "clr".

More information about the ragel-users mailing list