Whaddya mean state?

November 12, 2009
by Nathan Whitehouse (nw08)

So I realize that my explanation of how the interpreter and evolved program can interact was probably very unclear. Therefore, I threw together a quick diagram to illustrate how the two interact in the very simple case of adding a new entry.

In the example of adding a new list, the evolved program is actually doing very little work, as you can probably see. In fact, it’s probably doing about as much as the interpreter itself. This is because we are talking about about a very simple case. In order to search the database by keyword and return the relevant results, the program may have a few more steps.

Of course, I’m not just trying to create an address book; I’m also trying to use the same basic building blocks to create a flashcard application. This would required a different interpreter, but note that the differences between the two should be minor. All the (human) programmer needs to know when designing the interpreter are what input and output he or she wants the interpreter to handle for every state (which, granted, may take some thinking).

Also, it’s definitely worth mentioning that the successful I mentioned in class was NOT the one last posted to the blog (the tiny one). That was a first sign of life. The actual successful entry program does exactly what the pdf diagram posted above indicates. It gets a virtual keypress, goes to the entry state, receives input, puts that input in the database, and then resets itself:

(((intoMain newListSafer) (exec.if) (code.null intoEdit) (getInputList)))

Most of those bits of code are atoms I gave it:

intoMain puts the program into the main state (‘idle’ in the diagram) while intoEdit puts it into the second state (‘entry’ in the diagram)

newListSafer puts whatever is on the auxiliary stack into the master list.

getInputList retrieves the list input into the interpreter.

Note that the interpreter has yet to be programmed. I creating a simple ‘proof-of-concept’ interpreter is next on my agenda. I’d like to know this method isn’t crazy before applying it to all the other functions of a database.



Leave a Reply

You must be logged in to post a comment.