Tuesday, March 17, 2009

The State of the State of a Union...

I took some time last night and got my #@m// #@s/// expressions working. I think I will try to make #@"..." into Perl style strings. I might even turn it into an asdf module, cl-perl-me has a nice ring. But working with Lisp and regular expressions made me start thinking. Since regular expressions are simply state machines, why couldn't I just abstract state machines?

I mean, all I am saying when I type #@m/Bender/ is return true if I match a series of events which each match, in order, b, e, n, d, e, r. Why couldn't I also extend that to be something like this:

(dot #\B #\e #\n #\d #\e #\r))
Or, even to extend it some more:

(dot 'Bender 'is 'great))
Now it could take symbols and strings or even objects. Since a recognizer is just a subset of state machines, I could also create something more general:

(state-machine ((start
(:on-rest home
(format t "State Machine has Started")))
(:on-rest sweet
(format t "Home ")))
(:on-rest home
(format t "Sweet ")))))
This is similar to the state machine generator by Dave Roberts on findinglisp.com. But I seem to remember that many problems can be solved with hierarchical state machines. Can state machine generator handle it? Not as such, yet. As I keep working on the idea the bigger and more general it seems to grow. I would also like to add the ability to add states dynamically. This might come in very handy if I start doing some GUI programming with lisp.

Still, there are even larger problems I would like to solve. For instance, there have been many times when I've needed a YACC style parser and I always hate needing YAL (Yet Another Language). I'll post as I work on this side project.

Finally, you might be wondering what happened to Qix, the 3d Emacs-style user environment. I'm still working on it, but I've been stumped by vertex-arrays in cl-opengl. Hopefully, I should have a fix or a work around soon.

No comments:

Post a Comment