Discussion:
[ragel-users] Recursive rules
Eduard Bondarenko
2012-11-12 20:25:28 UTC
Permalink
How to implement recursive rules like:

if <condition> then
if <condition2> then
end
end

?

Best regards,
Eduard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.complang.org/pipermail/ragel-users/attachments/20121112/1ad2a904/attachment.html>
Robert Lemmen
2012-11-12 21:10:11 UTC
Permalink
hi eduard,
Post by Eduard Bondarenko
if <condition> then
if <condition2> then
end
end
the short answer is: you dont. ragel is a parser for regular languages,
and your example is not regular due to the recursion you are after. you
could however use ragel as your lexer and use something else as your
parser. if the number of such recursion cases is limited then you can
get away with just using ragel, byt essentially pushing the current
state onto a state, see fcall/fret in the ragel manual.

regards robert
--
Robert Lemmen http://www.semistable.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://www.complang.org/pipermail/ragel-users/attachments/20121112/bc440a0d/attachment.pgp>
Loading...