comp.lang.ada
 help / color / mirror / Atom feed
From: Matthias Kretschmer <m.kretschmer@bsdger.org>
Subject: Re: an infinate loop
Date: Thu, 19 Jul 2001 13:38:26 +0200
Date: 2001-07-19T11:38:26+00:00	[thread overview]
Message-ID: <3B56C6B2.559EE5F3@bsdger.org> (raw)
In-Reply-To: Di057.22614$Kf3.297841@www.newsranger.com

Ted Dennison wrote:

> So while I can't agree that "goto" inarguably makes this particular algorithm
> look better, it at least doesn't make it worse, and it performs it slightly
> quicker. I'm not sure that would normally be enough to justify its inclusion in
> the language. However, I'd observe that this issue comes up a lot more for
> compiler writers than for the rest of us, and compiler writers did create this
> language. :-)
>

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.

But in the other hand, just use aflex or something like that for processing strings
and do not think about the implementation. As long as the aflex-programmers did
their job well, one do not have to worrie how it is implemented and how to change
the specific implementation, just using it is enough.

But this leads to another way of implementing a state machine. Using an approach
similar to aflex and the like. Implementing the statemachine with rules that apply
to different states and having just one subprogram processing the rules stored for
example in an array of records or something like that. The array can be filled at
run-time by processing a file (which could lead to the problem of using a state
machine for this parser :-)) or by a constant array hardcoded in the program.

mfg Matthias




  reply	other threads:[~2001-07-19 11:38 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 [this message]
2001-07-19 14:28                   ` Ted Dennison
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