RE: DFA::StateMachine

2004-12-15 Thread Orton, Yves
Ovid and I were getting fed up with the horrible DFA::Simple module, so I wrote a new module, DFA::StateMachine, to take its place in our work. But I'm no computer scientist, so I'm not even sure whether the name is right or if the module functions the way a DFA state machine is

RE: DFA::StateMachine

2004-12-15 Thread Ovid
--- Orton, Yves [EMAIL PROTECTED] wrote: Maybe: FSA::Rules is better? I'm quite happy about that name, assuming it truly describes what we've done. I also don't have a strong comp-sci background, so I appreciate pedant mode. Having said that it looks like an interesting module. Id be curious

RE: DFA::StateMachine

2004-12-15 Thread Orton, Yves
Based on this definition, I'm not sure if my module is a DFA or an NFA state machine. In each state, you can define rules for transitioning to other states. When you call the check() method, it checks each of these in the order you defined them and transitions to the first state for which

Re: DFA::StateMachine

2004-12-15 Thread David E . Wheeler
On Dec 15, 2004, at 11:00 AM, David Coppit wrote: Yes, but not in the traditional sense. Traditionally, you can only have 1 transition from a state for a given input. i.e. the model all by itself defines a deterministic behavior. What you actually have is model+algorithm defining a deterministic

Re: DFA::StateMachine

2004-12-15 Thread fglock
On Dec 15, 2004, at 7:04 AM, Tim Bunce wrote: - I'd suggest renaming check() to attempt_transition() and have it return the new state or undef (not croak) if it can't transition at the moment. How 'bout I borrow DFA::Simple's Check_For_NextState()? No?

Re: DFA::StateMachine

2004-12-15 Thread David Coppit
On Wed, 15 Dec 2004, David E. Wheeler wrote: I guess that makes it a DFA, no? Yes, but not in the traditional sense. Traditionally, you can only have 1 transition from a state for a given input. i.e. the model all by itself defines a deterministic behavior. What you actually have is

ANN: FSA::Rules

2004-12-15 Thread David E . Wheeler
On Dec 15, 2004, at 12:43 PM, David E. Wheeler wrote: D'oh! I've already renamed it DFA::Rules in Subversion. Ah, well, at least it's easy to change. Look for the new module to be on CPAN later today. And here it is: The following report has been written by the PAUSE namespace indexer. Please

Re: DFA::StateMachine

2004-12-15 Thread David E . Wheeler
On Dec 15, 2004, at 12:00 PM, [EMAIL PROTECTED] wrote: - get_next_state() returns a new DFA object, which is in the next state. If there is no next state, it returns undef. What's that from? In version 2 I'll make the states objects. But this will do for now. :-) Regards, David

Re: RFC: DFA::StateMachine

2004-12-15 Thread David E . Wheeler
On Dec 15, 2004, at 3:56 PM, Paul Hoffman wrote: It seems to me that your code could be used to implement either a DFA or an NFA, so you might want to call it it an FSM. Algorithm::FSM, perhaps? Or maybe Decision::FSM?? I went with FSM::Rules. I think it's a good name, and falls in line, I

RE: DFA::StateMachine

2004-12-15 Thread David Coppit
On Wed, 15 Dec 2004, Orton, Yves wrote: The term DFA::StateMachine is like say Car::Car. Right. A DFA is by definition a state machine (it stands for determinisitic finite state automata). And after a review of the code IMO using the term DFA is a bad call. Normally DFA implies a specific type of

RE: DFA::StateMachine

2004-12-15 Thread Orton, Yves
David Coppit replied on 15 December 2004 14:21 On Wed, 15 Dec 2004, Orton, Yves wrote: The term DFA::StateMachine is like say Car::Car. Right. A DFA is by definition a state machine (it stands for determinisitic finite state automata). And after a review of the code IMO using the

Re: DFA::StateMachine

2004-12-15 Thread Tim Bunce
On Wed, Dec 15, 2004 at 10:08:43AM -, Orton, Yves wrote: Ovid and I were getting fed up with the horrible DFA::Simple module, so I wrote a new module, DFA::StateMachine, to take its place in our work. But I'm no computer scientist, so I'm not even sure whether the name is right

Re: DFA::StateMachine

2004-12-15 Thread David E . Wheeler
On Dec 15, 2004, at 9:42 AM, David E. Wheeler wrote: - Then define check() to be { self-attempt_transition() || croak ... } But a better name than check() would also be good. Ah, I guess you like the idea of attempt_transition() returning undef on failure but not die'ing, eh? I guess it'd be

Re: DFA::StateMachine

2004-12-15 Thread Ken Williams
On Dec 15, 2004, at 11:27 AM, David E. Wheeler wrote: On Dec 15, 2004, at 6:34 AM, Orton, Yves wrote: As far as I know a DFA is defined as a finite automaton where each state/input combination can result in only one legal transition. (http://en.wikipedia.org/wiki/Finite_state_machine) An NFA of

Re: DFA::StateMachine

2004-12-15 Thread David E . Wheeler
On Dec 15, 2004, at 12:02 PM, Ken Williams wrote: It short-circuits and there's no backtracking? That's odd. Seems like that should be stated in the docs somewhere, since that's how most people expect an FSA to work. I'm expanding the docs now, even as I incorporate people's suggestions. In

Re: RFC: DFA::StateMachine

2004-12-15 Thread Paul Hoffman
On Dec 15, 2004, at 2:17 AM, David E. Wheeler wrote: Ovid and I were getting fed up with the horrible DFA::Simple module, so I wrote a new module, DFA::StateMachine, to take its place in our work. Cool. But I'm no computer scientist, so I'm not even sure whether the name is right or if the module