Finite State Machine inherent support 
Author Message
 Finite State Machine inherent support

Is anybody aware of any computer languages that have inherent
support for finite state machines ?

What I'm interested in is how this is dealt with in the syntax
of the language. Something more elegant than a bunch of goto's and
lablems perhaps ?

Please respond by mail if possible.
--




Sat, 14 Dec 1996 02:32:54 GMT  
 Finite State Machine inherent support

Quote:

> Is anybody aware of any computer languages that have inherent
> support for finite state machines ?

> What I'm interested in is how this is dealt with in the syntax
> of the language. Something more elegant than a bunch of goto's and
> lablems perhaps ?

> Please respond by mail if possible.
> --



Although I responded at length by e-mail, part of the answer might be
more generally interesting. Some time ago I developed a 2-line (or so)
finite state machine compiler in FORTH that compiles a state-table
description into a subroutine (FORTH word). This work has been published
in Computers in Physics, Proceedings of the 1992 Rochester FORTH Conf., etc.
The technique has by now been widely adopted in the FORTH community and
applied to pattern recognition, text processing, process control and
computer games. The version I append has not yet been updated to conform
to the recently accepted ANSI FORTH standard, but is easy to modify to
so conform. (An exercise for the student? :-)   Use in good health!   --jvn

\ ================================================ FINITE STATE MACHINE
: WIDE   0 ;
: FSM:   ( width 0 -- )   CREATE   ,  ,   ]   DOES>   ( col# -- )

               *  +   1+  4*    ( -- adr offset )
               OVER +           ( -- adr adr'=adr+offset )


               SWAP !   ;       \ update state
\ IMPORTANT NOTE:
\ This version of FSM updates the state ***after*** the action.

0 CONSTANT >0   3 CONSTANT >3   6 CONSTANT >6
1 CONSTANT >1   4 CONSTANT >4   7 CONSTANT >7
2 CONSTANT >2   5 CONSTANT >5

\ ============================================ END FINITE STATE MACHINE

\ ========================================= Automatic conversion tables
: TAB:   ( #bytes -- )

\           ( n tab[0] -- n')

: install      ( col# adr char.n char.1 -- )   \ fast fill
               SWAP 1+ SWAP   DO  DDUP I +  C!  LOOP  DDROP ;
\ ===================================== end automatic conversion tables

\ Usage example

0 VAR id.len
: +id.len   AT id.len  1+!  ;
: >1?    id.len  7 <  DUP  1 AND  SWAP  NOT  2 AND +  ;
3 WIDE FSM: (id)
\ input:     |  other  |  letter   |    digit    |
\ state      -------------------------------------
   ( 0 )       NEXT >2   +id.len >1    NEXT >2
   ( 1 )       NEXT >2   +id.len >1?   +id.len >1?  ;

128 TAB: [id]
1 ' [id]  ASCII Z  ASCII A  install
1 ' [id]  ASCII z  ASCII a  install
2 ' [id]  ASCII 9  ASCII 0  install

\ is this a proper BNF id?
: <id>   ( $end $beg -- f)   \ f = -1 for id, -2 for null, 0 else
         DDUP  NULL D=  IF  DDROP  -2  EXIT  THEN
         0 IS id.len   ' (id) 0!      \ initialize

                 DDUP  >              \ $end > $beg ?

         WHILE   1+  REPEAT   DDROP

--
Julian V. Noble



Sun, 15 Dec 1996 03:40:14 GMT  
 Finite State Machine inherent support
How about sendmail.cf?

(grin)
--
Peter da Silva                                            `-_-'
Network Management Technology Incorporated                 'U`
1601 Industrial Blvd.     Sugar Land, TX  77478  USA
+1 713 274 5180                       "Hast Du heute schon Deinen Wolf umarmt?"



Tue, 17 Dec 1996 03:08:59 GMT  
 Finite State Machine inherent support

Quote:
> Is anybody aware of any computer languages that have inherent
> support for finite state machines ?

I would suggest you examine the formal specification language known as
Estelle.
It is primarily designed for specifying computer network protocols.
Check out comp.specification and ask around there, or send mail to

   Have fun!     -- Darren

--
445 South St/MRE 2E-279/Morristown NJ 07960 USA/(201)829-4833
Delivery of Electronic Multimedia over Networks (DEMON)
Also, formal description techniques, programming languages.
``Your fault: Core dumped.''                EFF#846
``Sometimes, you just have to bite the silver bullet.''



Sat, 14 Dec 1996 21:52:03 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. finite state machines, state cad

2. Finite State Machine and Forth

3. Finite State Machines

4. ESTEREL, Forth and finite state machines

5. finite state machines

6. Finite state machine compiler

7. Finite State Machines

8. OO Finite State Machine Language

9. cisco_fsm (finite state machine) free tool: pre-announcement

10. Use of a Finite State Machine in testbench code

11. FSMedit - The Finite State Machines Editor - Version 2.0

12. finite-state-machine problems => Synopsys

 

 
Powered by phpBB® Forum Software