|
Thu Apr 12 23:12:36 EDT 2007
ragel state machine compiler
--
In a nutshell, Ragel is a meta language for describing an FSM im-
plicitly using regular expressions. It is meant to allow for the
building of large and complex FSM based on smaller regular ex-
pressions and operators, such as union (or), concatenation, in-
tersection, etc. I personally think this is precisely the ap-
proach needed to build and use FSM to do useful things. It re-
quires some intuition regarding to the construction of an FSM
based on regular expressions, but due practice easily gives one
this. This meta language is placed directly inside of a host
language source file. It currently supports C/C++, D, Object C,
and Ruby. You write your host language program assuming that the
code to handle the FSM will be put in there. So once it is writ-
ten, the source code with the embedded Ragel meta description is
"compiled" using the Ragel compiler. After that happens, you
must compiler it using the host lanaguage. Ruby code obviously
requires no compiling.
My need currently is to write a simulator for a distributed and
asynchronous MAC protocol. In addition to facilitating the book
keeping of the simulation, I intend on facilitating the interac-
tion of the node, all of which will have their own FSM, by inter-
secting some number of FSMs (in the case of a fully connected
network topology).
In fact, by utilizing the regular expression constructs properly
I should be able to define any network topology that I wish. An-
other cool thing is that since I am going to be defining the
nodes independently, each node could actually have different
FSMs. In this case, they will be identical however.
I will definitely report back about my experience. The more I
learn about Ragel and think about how I might implement the pro-
tocol using regular expressions and event triggers, the more ex-
cited I get.
Cheers.
--
Powered by vee Copyright © 2006-2008
|
|