[ragel-users] Re: Nested machines to make a HSM?
Chuck Remes
cremes.devl... at mac.com
Mon Jul 21 13:41:10 UTC 2008
On Jul 18, 2008, at 6:27 PM, Adrian Thurston wrote:
>
> Hi Chuck,
>
> If you were to design your state machine using the comma and epsilon
> operators you would run into the problem of referencing names that are
> not in the current machine.
>
> If you were to use fgoto though you could take this approach.
>
Adrian,
I definitely ran into the problem where I couldn't reference names
outside of the current machine because I stuck with the epsilon
operators. It didn't occur to me to try fgoto.
In the meantime, I ended up implementing Miro Samek's code in ruby. I
submitted it to him so he could add it to his contributions page. I've
already been pinged off-list a few times about this code. If anyone
else is interested in looking at the code, it can be found here:
http://www.state-machine.com/downloads/contributions.htm
It doesn't have all the optimizations of his C and C++ versions (plus
it is based off his "old" QEP 2.0 framework which is now at 4.0), but
it still represents his ideas pretty clearly. His C code was a bitch
to follow so I refactored it so it was simpler to follow. As a result
it is even slower than you would expect a pure ruby port to be since
some work is performed 5 or 6 times, but I found the clarity worthwhile.
cr
More information about the ragel-users
mailing list