[ragel-users] One question.

Nate nathan.sweet at gmail.com
Thu Apr 7 22:50:06 UTC 2011


I've now done a couple projects with recursion using fcall. It isn't too
bad. Is there something I lose by doing this, beyond the ability to express
the recursion in Ragel? What would really make switch tools for a project?

-Nate


On Thu, Apr 7, 2011 at 1:22 PM, Adrian Thurston <thurston at complang.org>wrote:

> To expand on this a bit ... it is entirely up to the user to manage the
> stack allocation. Ragel's support for recursive structures (fcall/fret) is
> an extension to the basic model, which is pure state machine (not a PDA). If
> you find you have a lot recursion in what you need to parse, you should
> consider that ragel might not be the right tool for the job.
>
> Regards
>
>
> On 03/29/2011 09:59 PM, Nate wrote:
>
>> Yes, see the int[] stack in the link. :) Also note the code under
>> "prepush".
>>
>> -Nate
>>
>>
>> On Tue, Mar 29, 2011 at 9:38 PM, Gordeev Vladimir
>> <gordeev.vladimir.v at gmail.com <mailto:gordeev.vladimir.v at gmail.com>>
>> wrote:
>>
>>    Hm, this looks like solution. I will try it. Thanks.
>>
>>    Related question: Does Ragel have some inner stack to handle nested
>>    fcall/fret?
>>
>>
>>    On 30.03.2011 00:59, Nate wrote:
>>
>>>    You can use fcall to jump to a machine, then fret to resume where
>>>    you were. It's a bit tricky, but once you understand it you can
>>>    parse recursively. See the startTable action here (though this is
>>>    a pretty hairy parser):
>>>
>>> http://code.google.com/p/table-layout/source/browse/trunk/build/TableLayoutParser.rl
>>>
>>>    -Nate
>>>
>>>
>>>    On Tue, Mar 29, 2011 at 2:55 PM, Jonathan Castello
>>>    <twisolar at gmail.com <mailto:twisolar at gmail.com>> wrote:
>>>
>>>        On Tue, Mar 29, 2011 at 1:15 PM, Gordeev Vladimir
>>>        <gordeev.vladimir.v at gmail.com
>>>        <mailto:gordeev.vladimir.v at gmail.com>> wrote:
>>>        > So I got following error:
>>>        >
>>>        >     test.rl:7:32: graph lookup of "list" failed
>>>
>>>        The reason you get that error is because a rule can only reference
>>>        definitions that came before it. "list" doesn't exist until the
>>>        definition is finished, so it can't reference itself. (That would
>>>        create a recursive structure anyways, which Ragel isn't
>>>        equipped to
>>>        handle natively.)
>>>
>>>        ~Jonathan
>>>
>>>        _______________________________________________
>>>        ragel-users mailing list
>>>        ragel-users at complang.org <mailto:ragel-users at complang.org>
>>>
>>>        http://www.complang.org/mailman/listinfo/ragel-users
>>>
>>>
>>>
>>>    _______________________________________________
>>>    ragel-users mailing list
>>>    ragel-users at complang.org  <mailto:ragel-users at complang.org>
>>>
>>>    http://www.complang.org/mailman/listinfo/ragel-users
>>>
>>
>>
>>    _______________________________________________
>>    ragel-users mailing list
>>    ragel-users at complang.org <mailto: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
>> --===============092103
>>
>
> --
> Adrian D. Thurston
> http://www.complang.org/thurston/
>
>
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20110407/933dc7e0/attachment-0001.html>
-------------- next part --------------
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users


More information about the ragel-users mailing list