[ragel-users] Ragel goes while(1) with the following scanner.

david.keller at litchis.fr david.keller at litchis.fr
Mon Jun 8 11:56:32 UTC 2009


I see.

Thanks.

On Sun, 07 Jun 2009 20:58:13 -0400, Adrian Thurston 
wrote:
> The reason ragel seems to run endlessly is that you're getting a state 
> explosion. The machine:
> 
> comment = '#' any* -- newline;
> 
> Is not terminated with a newline. It's just a string that starts with 
> '#' and cannot contain a newline. When you put this in front of alnum 
> (in bulk?) you create an ambiguity that is costly for ragel to implement

> with a deterministic state machine.
> 
> Do this instead:
> 
> comment = '#' (any* -- newline) newline;
> 
> Or use :>> as you suggested.
> 
> Cheers,
> Adrian
> 
> david.keller at litchis.fr wrote:
>> Hi
>> 
>> When using this scanner (I removed actions), ragel seems to loop
endless.
>> 
>> %%{
>> machine configuration_parser;
>> include scanner_common "scanner.rl";
>> 
>> newline = 'r'? 'n';
>> 
>> comment = '#' any* -- newline;
>> 
>> bulk = ([tvf ] | comment | newline)+;
>> 
>> key = bulk? (alnum ([_.]? alnum)*);
>> 
>> value = bulk? """ any* :>> """;
>> 
>> values = bulk? value (bulk? ',' value)*;
>> 
>> assign = key bulk? '=' values;
>> 
>> main := assign* bulk?;
>> }%%
>> 
>> 
>> 
>> But I works like a charm when:
>> 
>> comment = '#' any* -- newline;
>> 
>> become:
>> 
>> comment = '#' any* :>> newline;
>> 
>> 
>> 
>> 
>>
------------------------------------------------------------------------
>> 
>> _______________________________________________
>> ragel-users mailing list
>> ragel-users at complang.org
>> http://www.complang.org/mailman/listinfo/ragel-users
> 
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maurice_moss.jpg
Type: image/jpeg
Size: 8414 bytes
Desc: not available
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20090608/291612dc/attachment-0001.jpg>


More information about the ragel-users mailing list