Haven't done much in a while. I got user defined verbs up and running. This was a major hurdle and I think I did a pretty good job, I need to now figure out scopes. Like, if you define a Goblin in one region, then can you import it? I think what I'm going to do is write a simple pointer system, and allow symbolic linking between objects. Allow me to define regions and objects so they don't get too confusing. The entire program is a world. Inside the world are regions. Each region may contain regions, or objects or both. It may even be able to be a world itself, however, regions may share resources. An object is like an atom, the smallest, indivisible unit in the language. Objects are like goblins, or text controls, you can't really break them down unless you get into the "nitty-gritty".... read more
Sorry for no update recently, complex problems arose in real life.
Got a bit further, and added a new verb, Define. It allows definitions of verbs and functions. All's well and good but I'm grappling with how to handle functions. I've been toying with the idea that I could just make them a variable, and the lpValue pointer would be a linked list (or even an array) of the tokens in the function. I don't know if that's any good, and I REALLY don't know how I will deal with scopes. Maybe I'm smart for making this a class. That way things can get inherited. Who knows.... read more
... to write something. I've been wrestling with this thing, trying to implement structure and membership. I have it working (somewhat, it is in temporary kludge form, as I eventually want support for vectors of structures). But I have leaks... Bad leaks.
General -
Revamped the whole interpreter AGAIN! Man, I'm getting sick of the interpreter code, I just want to start on something else! However, I want the interpreter to be bulletproof and robust before I start adding features. I removed the Expression/Data class system for tokens and reinstituted the Token, but this time as a class. Tokens have 16 bytes, compared to the Expression/Data system of about 40-50 bytes, and are functionally equivalent. Then I purged the memory leaks and current implementation bugs. Things were good until I realized that for every token in the Symbol Table, I was performing 2-3 lookups to get its value so that I could first verify that it was there, then so that I could alter the contents if necessary. This, obviously, was not going to last. I changed the Token (formerly the Expression) and Argument stacks to only handle Token **'s (that's right kiddos, I got smart and am now just allocating/moving 4 bytes for every stack addition or copy). This also complicates memory deallocation, because of the pointer, the original is not being copied. This means that I have to weed through the code and find all instances of new and delete that are unnecessary (so far so good, but I have not tested every possible problem :-/). And it leaks.... Like 50K/sec when running it 100 times a second.... read more
The interpreter needed a small bit of tweaking. I ditched the Linked List all together and now it is totally stack based, while still addressing the order of operations. I slimmed down the Expression class and added a Data class to it, which represents the raw data elements, and I did a bunch of testing on those. The Data class allows data to be treated transparently (lots of overloading...).
Now the Expression class has a STACK * to the arguments that are passed to it, I didn't want to do it that way, but the way I do the Expression Stack, I had to. Each Expression is only 16 bytes, and each Expression contains a stack, which is 16 bytes and a Data element, which is 12 bytes. Now, the stack obviously grows with each element pushed, and the Data can grow very quickly depending on the type of variable passed to it (if you create a matrix of floats for example, that runs at 12 + 12 + 10 bytes for one element).
I don't know if I like the amount of overhead that exists there, however to keep the robustness I think that overhead is necessary.
It's not so bad though, at minimum doing a quick calculation, each Expression takes 44 bytes, or 1/23831 of a Megabyte (or is it Mebibyte?) So it would take a while to overwhelm even a pretty low-RAM computer. ... read more
Variables are indeed working now. You can type the statements:
NewNoun Spawn[string];
NewNoun = "chimes.wav";
Play[NewNoun];
and lo and behold, chimes.wav will play! Tomorrow afternoon (after I replace the dumb oil sending unit in my car...grr.) I am going to print off the main interpreter files to look at and trim as much fat as I can. Look here again in a half a week or so for a far more functional and more sleek revision of the interpreter.
First and foremost, the dumb Expression class needs refinement. Firstly, I need to make each Expression more robust while decreasing the memory requirement. Have no idea how I'm gonna do that.
Secondly, comments! I have been lax with myself on commenting the code. NO MORE! I need them now as much as anyone else.
Third, consolidating the implementation and interpretation into one class, or at least finding a better way to share resources. Who knows what I'm gonna do. Certainly not me.
Well, night time early for me, I'm tired. Later.
Ok, I've changed the error handling. No more bool returns, Now it's just one catch statement in the ParseFile() function and multiple throws wherever an error could occur in the file. That took a bit of wrangling because of a certain race condition where it would delete the stupid class before it was done with it. Grr.
Stupid self-corrupting operating system. I think it was the RAID drivers, so no more RAID array (which sucks, because I liked the data security), anywho... I'm back and development will continue tonight or tomorrow, although I gotta install Windows 98 on a machine bright and early tomorrow, so we'll see how I feel.
I would like it if you visit this site that you could EMail me or write a comment, at least until I set up a webpage, I like knowing people are actually seeing this.
That's all for now.... read more
My box has decided that windows include files are the tastiest mosels, and has eaten parts of them. I have to reinstall the SDK, and possibly the OS. Development will resume as soon as I can figure it out.
It's working to my liking now, I just need to test compound statements and large math statements (like 3 + x * y / z - 1) just to see if the order of operations is working ok and if the expression list stack is also working ok. Development is coming along, nothing happened today, went to a show, woohoo! I keep making sure no memory leaks pop up after I finish about 1000 or so lines. It may not be efficient, but I prefer to check for leaks while the code is still fresh in my mind. Um, the next verb I'm working on (besides the arithmetic verbs +,-,*, /, %) is the Spawn[] verb. It is the malloc() of the script, however it only allocates objects. Pretty soon I hope to have a full language definition completed so that I can start adding verbs at a mroe rapid pace (which will happen once I make sure the interpreter is bulletproof). I've uploaded the latest and greatest, if anyone wants to get it. It doesn't do anything, because I've been debugging it and hearing chimes.wav a million times is maddening. Goodnight, I'm going to bed.
Been working on interpreter. I have it how I like it, I just need to iron out some details with order of operations and assignment, as well as compound statements. Other than that, by writing Play["soundfile.wav"]; you can play a sound!
I am not going to submit any files however, until I can be sure I like how the interpreter works. I am pretty embarassed at the interpreter work I uploaded here and hopefully those of you who have downloaded it don't believe that's how the end result will look. But hey, this is my first interpreter, with no real help, so it's bound to suck.
Again, email me (petermondlock) if you have any questions/comments. I also have a sort of Manifesto of what this is supposed to accomplish that I may upload later. Later.
While working on the interpreter, I decided it was too inelegant, and scrapped the one in the ACE file. I am in the midst of writing a new one using a binary tree and a stack. So far so good, it compiles and does what it should for being barely worked upon. The Tokenizer is in good shape I think and I will be writing an application that allows for the easy creation of system words (mostly verbs). This tool will (hopefully?) eventually adapt to a visual environment for the interpreter. Who knows. After the interpreter is 70-80% completed (right now I wouldn't even say it's at 5%), I will work on the SGML parser for the object data (AKA nouns in the interpreter). Anyone who wants to help, give me (petermondlock) an email... I've been wanting to unload some of this onto someone else :). ESPECIALLY if you want to work on the SGML parser, or know a lot about interpreter design.