runaway action

Manfred_Nowak svv1... at hotmail.com
Fri Aug 8 19:12:09 UTC 2008


On 8 Aug., 18:32, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
> some code and the expected result?

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.

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".

In the definition of the machine `all' the state labelled `start'
corresponds via epsilon production `''->l1' with the state labelled
`l1'. In principle this means, that whenever a transition `-> l1' is
followed a `clr' action should be executed.

But all I managed to get is a "clr" for every character read or no
"clr" at all.



More information about the ragel-users mailing list