From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,5ea22870217a3d5a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.66.251.193 with SMTP id zm1mr2457862pac.15.1361438146642; Thu, 21 Feb 2013 01:15:46 -0800 (PST) Path: ov8ni12702pbb.1!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!novia!news-hub.siol.net!news.mi.ras.ru!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: References on encoding (Hierarchical) State Machines / Automata in Ada? Date: Wed, 13 Feb 2013 22:28:40 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Injection-Info: mx05.eternal-september.org; posting-host="0a6ca0935c728e617c1a2d4bdcfc6a33"; logging-data="16957"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KvnOCkHDYtozGJCbtqTNyA9WnTOSpaLE=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (darwin) Cancel-Lock: sha1:pBXwxqY1UvGTjH+Bc37SGQan6fM= sha1:09fJPHPokyo3Gf5BBjBdEGJVcsc= Content-Type: text/plain Date: 2013-02-13T22:28:40+00:00 List-Id: Jeffrey Carter writes: >> david.mentre@gmail.com writes: >> >> Would somebody have references on the encoding of State Machines or >> Hierarchical State Machines in Ada? > > I recall someone named Robert Dewar (whoever he is :) saying that the > mechanical implementation of STDs is a place where one should use > "goto". That was here on c.l.a: > > https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.ada/tFlS5d7bfpo I can understand that if the FSM is a task - you're implementing the states in terms of the program counter, nothing wrong with goto for that. But if you've inverted this, so that the FSM is a passive construct, you're going to need an enumeration of the possible states, and some way of representing the possible events (I made an abstract type Event_Base with an abstract Handler, then each concrete event that could be received by a particular FSM has a case statement over the possible states; the whole thing generated from a UML model [1]). [1] http://coldframe.sourceforge.net/coldframe/events.html