[ragel-users] Re: Problem: Change state only when a new input is received

Adrian Thurston thurs... at cs.queensu.ca
Thu Jul 12 07:05:51 UTC 2007

Hi Aditi,

> 1.) %% write exec will be executed in every iteration of the loop.
> Will this effect the performance? Is there a better way to do it? I
> couldn't get it working by putting it just once outside the loop. I am
> using this to build a tool which is required to be efficient, that's
> why I am concerned with this point.

As far as I can tell you need the code generated by write exec to run on
every iteration of the loop. The only consideration here is that there
will be an unnecessary check of p against pe. In this case pe - p always
equals one. This should just be a few processor instructions however. If
you really need to squeeze out instructions and you are concerned you
can always look at the generated code.

> 2.) The printing of the tokens and the action triggered(as of now,
> just a print statement) happen only after I send the next token. Why
> is there this delay of one token in the processing. Is my approach not
> correct?

My best guess is that you are embedding actions using the '%' operator.
Provide some ragel code and I'll tell ya for certain :)

> 3.) There are certain other issues also, like I want to match this
> pattern anywhere in the string and may be multiple times if it occurs.
> This is not happening here. This code works if I give my pattern in
> the beginning only. What should I do?




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20070712/ccc91ae9/attachment-0001.sig>

More information about the ragel-users mailing list