[ragel-users] Re: Bug or feature?

Adrian Thurston thurs... at cs.queensu.ca
Fri Jul 20 16:16:10 UTC 2007


Carlos Antunes wrote:
> Adrian, my point is that when the start and final states are one and
> the same, there is no difference between "pending in" and "pending
> out". In the example above, and using the old semantics, ">action_b"
> may indeed represent a "pending out". But this is consistent with what
> I've said: there is no semantic difference between "pending_in" and
> "pending_out" when start and final states are one and the same. And
> the empty machine just so happens to have a start state
> indistinguishable from a final one, no?

Yes, that's right. I do like the idea of reducing the number of
operators and if I were to redesign ragel from the ground up this kind
of operator would be something to consider.

It would depend on the whole redesign, but I think a starting operator
(the current semantics) could still be desirable. Consider:

m1 = ':';
m2 = [a-z]*;

action act1 { printf( "first char of m2 is %c\n", *p ); }

m = m1 ""%act1 m2 '\n';

Just to be clear, this is equivalent to the old semantics of >. With
this you get the message on the newline in the case that m2 matches
nothing, which is wrong. You have to refactor things in order to "fight"
the behaviour of the operator. I don't like that. I'd rather you have to
refactor things to add the above effect when you want it. This is one of
the reasons for me simplifying > and making it go ONLY on the first
characters of the machine, not also on pending out actions when the
start state is final.

> However, I understand the syntactic simplicity of "<expr> <op>
> <action>" and, as much as I think it would be cool, it is not that
> important from a practical point of view. Maybe, as a suggestion, you
> could mention the ( "" %action ) trick in the documentation?

I think a ragel "tricks/hacks" section would be good. I can think of
other stuff to put in there :)

-Adrian

-------------- 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/20070720/cf9cbefd/attachment-0001.sig>


More information about the ragel-users mailing list