Showing posts with label Lisp. Show all posts
Showing posts with label Lisp. Show all posts

Wednesday, June 23, 2010

THINK; then DO!

You can spend all day flailing at a keyboard and accomplish nothing. A few moments of thought make everything clear!

I've broken the text into lines and let then loop through them, collecting width, height, text length, and line data. I'm hoping this will work for longer lines of text, but we will see. I need to remake the text movement, insert, and delete code but now I'm feeling hopeful about the thing. Text looks like it's in the bag.

Next will be building the REPL. I'm looking at PREPL, and it's a great guide for this sort of thing. But it's not exactly what I need. I'm trying to make something simple for the duration, so I can get to the graphics again. I'm bad about getting sidetracked so I need to remember why I am building this in the first place.

Basically, I want a REPL with some simple restart capability. The biggest problem at this point is determining how to display the debug info! I'll start by just dumping it, without backtrace data (I'll print that back to slime) and let the user choose a restart. I'll need a little more work with the I/O but I think this is the easy way.

I still have a long way to go, but soon I hope to have Pango and FreeImage binding released and some simple graphics to play with!

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:

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

(create-recognizer
(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")))
(home
(:on-rest sweet
(format t "Home ")))
(sweet
(: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.