comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: an infinate loop
Date: Thu, 19 Jul 2001 14:28:05 GMT
Date: 2001-07-19T14:28:05+00:00	[thread overview]
Message-ID: <V7C57.490$Y47.5257@www.newsranger.com> (raw)
In-Reply-To: 3B56C6B2.559EE5F3@bsdger.org

In article <3B56C6B2.559EE5F3@bsdger.org>, Matthias Kretschmer says...
>Another way of implementing a state machine would be to make an array of 
>subprogram access types to subprograms handling the different states. This 
>could be faster than using case with using the current state as an index to 
>the array. This should be nearly as fast as using goto, just it doesn't use 
>fixed jump-points. But if you just implement features because of speed 
>enhancements of special problems, than you should implement everything 
>including an assembler. Goto doesn't make it look worse, but make it may be 
>more complicated. Using for each state a seperate subprogram would be probably 
>make the whole stuff more appealing to the eyes of other people.

To pull this off, you'd still need a loop around everything so you could iterate
through the array. This is essentially the same as a case statement in a loop,
except that you are replacing the "case" with an array. Another difference is
that you now have subprogram call overhead for each state change.

Often jump-table type code can be replaced with dynamic distpatch too, and that
allows users to arbitrarily modify the routines in the jump-table without
modifying the existing (debugged) sources. If this line of reasoning in lexical
analysis interests you, you really ought to look into OpenToken, which
implements it. See http://www.telepath.com/dennison/Ted/OpenToken/OpenToken.html



  reply	other threads:[~2001-07-19 14:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-12 21:43 an infinate loop Beau
2001-07-13  3:21 ` DuckE
2001-07-13 13:57 ` Ted Dennison
2001-07-13 17:01   ` Jeffrey Carter
2001-07-13 18:11     ` Ted Dennison
2001-07-13 22:26       ` Jeffrey Carter
2001-07-16 15:14         ` Marin David Condic
2001-07-17 17:02           ` Matthias Kretschmer
2001-07-17 17:56             ` Marin David Condic
2001-07-17 19:25               ` Ted Dennison
2001-07-19 11:38                 ` Matthias Kretschmer
2001-07-19 14:28                   ` Ted Dennison [this message]
2001-07-17 17:13           ` Warren W. Gay VE3WWG
2001-07-14 23:41       ` Darren New
2001-07-16 13:24         ` Ted Dennison
2001-07-16 15:19           ` Marin David Condic
2001-07-13 20:40     ` chris.danx
2001-07-13 22:29       ` Jeffrey Carter
2001-07-14 14:00         ` Robert Dewar
2001-07-14 16:17           ` Negative Logic (was: Re: an infinate loop) Jeffrey Carter
2001-07-17  4:06             ` Robert Dewar
2001-07-17  4:23             ` Robert Dewar
2001-07-16  9:26           ` an infinate loop Philip Anderson
2001-07-19  9:32             ` an infinite [was: infinate] loop AG
2001-07-15 21:18   ` an infinate loop Matthias Kretschmer
2001-07-16 21:59   ` Stephen Leake
2001-07-13 16:48 ` C. Bauman
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox