Making MPM a prefilter library. Step4: Constructing the state machine.