Agent/Message/State Machine RRS feed

  • General discussion

  • The note on Message Processing and State Machine on p. 379 of Expert F# 2.0 struct a cord... I was wondering if there was any further reading recommended on the topic.
    Friday, July 8, 2011 3:27 AM

All replies

  • I guess you want further infos on state-machines right?

    The concept itself is rather easy: you have a set of states {S1,S2,....} and a set of input-tokens/symbols: {I1,I2,...}. The next thing you need is a function/table, that maps a Input/State-Pair to a new State: f : Input*State->State. Now the statemachine are these 3 things together with a start and end-state. All you do is remember the (initial-)state and chain user input with the function f to get new states that you remember. In the end you can check the user-input.

    Those things are used in regular-Expressions, Compiler-Compilers, ...

    You can find more here: http://en.wikipedia.org/wiki/State_machine (but the article might need some refinement) or in most beginning CS books.

    (EDIT: if you want more on the MailboxProcessor as a state-machine then I guess the little box on page 379 has more or less all there is to know - you mix "f" i mentioned above with the input-processing and do call "return! statex" in the async {...} where aprobiate.)
    Friday, July 8, 2011 4:25 AM