Given a regular expression, I'm looking for a package which will dynamically generate the code for a finite state machine that implements the RE.
C/C++ and Python preferred, but other languages are of interest as well.
6.3. The FSM can be of two types: Moore (where the output of the state machine is purely dependent on the state variables) and Mealy (where the output can depend on the current state variable values and the input values). The general structure of an FSM is shown in Figure 6.7.
In a conventional finite state machine, the transition is associated with a set of input Boolean conditions and a set of output Boolean functions. In an extended finite state machine (EFSM) model, the transition can be expressed by an “if statement” consisting of a set of trigger conditions.
As the number of state variables in the system increases, the size of the system state space grows exponentially. This is called the “state explosion problem”.
What happens if the input is low in FSM? Explanation: There is no transition in the state if the input is low. If the system is in a particular state, it remains in that state only until the input becomes high.
re2c generates C code. I'm not sure what you mean by 'dynamically' -- AFAIK you'd have to compile and dynamic-load the output, if you want to call on the generated code during the same run that you generated it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With