[ragel-users] Re: Inline scanner

Adrian Thurston thurs... at cs.queensu.ca
Thu Jul 5 18:04:30 UTC 2007


Carlos Antunes wrote:
> Adrian, the code you sent, while very useful in my case, is a hack!
> This preprocessing code is necessary because ragel is not able to
> efficiently handle a SIP parser in practical terms, with only
> priorities.

Indeed, the code is a hack. However, I think it is the appropriate
implementation technique for an inline scanner feature so we should be
playing with it. This is how I work on Ragel: mock up the new feature,
then try to do implementations using the existing syntax. It shows you
exactly where the existing language fails and gives you lots of insight
into how the new feature can be implemented in the Ragel compiler. If
it's not really a new feature that you need, but instead a coding
technique, it usually shows that as well.

I should tell you that this problem is well suited to my current
project. It's called Colm (for computer language manipulation) and it
could possibly become my PhD thesis project. It's not currently
released. Colm is going to be a transformation system in the spirit of
TXL (http://www.txl.ca/). The parsing engine is what you would be
interested in. I don't want to give details at this point, but I think
it would provide for an easy implementation of the SIP grammar. So part
of me wants to say "just wait for that" ;)

But since that's not really of use to anyone right now I think the way
to proceed is to do more of these implementations using existing ragel
syntax. I will send some more soon.

> Assuming I understand the idea you are trying to convey here (there's
> a good chance that I don't), isn't it possible to transition directly
> to the scanner by looking at all the potential transitions of the
> scanner as if it was a "normal" state machine?

Yes, that's possible. The code I sent does exactly that, only it's
explicitly implemented. When it sees a whitespace character it jumps to
the whitespace scanner. I'll rework what I sent so hopefully it's clear
that it is an implementation of an inline scanner.

Regards,
 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/20070705/225ae0af/attachment-0001.sig>


More information about the ragel-users mailing list