which language

Tim Writer tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org
Sun Feb 1 19:33:21 UTC 2004


"Peter L. Peres" <plp-ysDPMY98cNQDDBjDh4tngg at public.gmane.org> writes:

> I am working on my idea of writing state machine descriptions in a
> 'language' of mine. I do not know what language is best to implement it.
> To the point: I would like to use arity and type-based function
> implementation matching, as is available in C++ and Prolog. Can this be
> done in Perl or TCL or Python without reinventing the wheel ? I.e. is
> there a straightforward syntax to write:
> 
> function foo(a) { print a }
> function foo(a,b) { print a+b }

Henry already responded regarding arity and type matching for function calls.
However, I'm curious, why you would require this feature for implementing a
state machine.  The states of state machines are quite naturally described as
a mapping from an input (often a character) to an action (such as drop the
character, shift the character onto the token buffer, goto another state,
etc.).  Consequently, a procedural representation of states (using functional
composition) is a powerful and concise way to represent state machines.  A
detailed example in Scheme is given in "Essentials of Programming Languages"
by Daniel Friedman et al.  The more conventional table based approach is easy
to implement in any of these languages and doesn't obviously benefit from
arity and type matching for function calls.

-- 
tim writer <tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org>                                  starnix inc.
905.771.0017 ext. 225                           thornhill, ontario, canada
http://www.starnix.com              professional linux services & products
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list