Wow! It's been a month since my last update regarding this pet project. To be fair, I did go on vacation for a week, so it's really only been about 3 weeks of spare time effort on this. With that said, I think it's moving along at a rather excellent pace.
Additional work done to the parser. Decided to remove a lot of the validation and treat this layer as more of a tokenizer that can then be further validated at the interpreter level.
After getting everything working in Silverlight and continuing the project for several weeks, I recently attempted to get the interpreter working in Windows Phone 7. I created a new project and copied over the code. Tons of errors. Several VB language features not available, more .NET Framework elements MIA and slight differences with Silverlight implementation on both devices. I remembered a discussion about a relatively new project call the Portable Library Project. After getting the correct service packs and such, was able to create a Portable Library version of the interpreter which required that I split several pieces out (and up) to a platform specific layer. The portions are labeled as Display, Keyboard, Sound and File System. Once done, I now have a core assembly that is capable of being leveraged across .NET 4, Silverlight 4, Windows Phone 7 and Xbox 360 (in theory).
A lot of work was still to be done since the last update in order to fully handle the "IDE" aspects; mostly related to what I'm calling "last line issues".
OK, I thought Silverlight was limited with regards to intercepting and working with the keyboard. Wow! Windows Phone 7... you're my new worst enemy. Why do you have a KeyUp/KeyDown event yet never can tell me the state of the Shift key? I had to work a serious hack that takes 50+ lines of code to do what should realistically be less than 3.
I also had to handle the concept of a key buffer so that "type ahead" would work while a pending task was executing (file system).
One goal that I had in mind was I wanted to support the file system functionality in such a way that it was not "local storage". I'd like to make it so that people can share content among one another, so it was necessary to create a file system that would work over the wire. All of the "IDE" functionality is fully supported. Eventually this layer will have to handle random access file functionality necessary to implement various file I/O keywords (which are not completed as yet).
The 5th keyword in the GW-BASIC manual is BEEP. Since BEEP is an 800 Hz for 1/4th of a second tone, it made sense to tackle two keywords at once since SOUND 800, 4.55 produces the same result. A fortune would have it, Silverlight 3+ has the ability for me to fiddle with the PCM stream. It does have it's problems and, apparently, Silverlight 5 might be able to provide some solutions to the "lag" that I'm experiencing. I have not tried this code yet on WP7; however, what is coming to Silverlight 5 is already supported on the phone implementation of Silverlight.
As of this writing, 114 keywords have been implemented. This is not to say they are 100% completed, but they are implemented enought to start testing and tweaking. Additionally, definable functions, arrays, nested for loops, etc. are all working. I've also implemented a few useful keywords that are not part of GW-BASIC which include OLD, LBOUND, UBOUND, LCASE$, and UCASE$. LBOUND and UBOUND have been very helpful in working with getting arrays working.
As you can see, a lot of work for three weeks of spare time. To put things into perspective, I think I have all keywords implemented based on documentation for the Dartmouth Oct'64 version as well as all of the listed keywords necessary for both BASIC Computer Games - Microcomputer Edition books (c. 1979) which is based on Microsoft Basic, Revision 4.0. I have not done any testing of the programs included as a lot of them are kind of long. However, I've also been working my way through "A Bit of IBM BASIC" and all code samples up to page 90 are working. There's still a potential for a lot of bugs, so testing...testing...testing...
So far this has been an awesome side project and there is still a ton of things to complete. I'm having a lot of opportunity to experience several technologies that I have not been able to play with in my "day job"; so this alone is worth the time and energy going into this project. Who knows where it will end up; however, I have to remind myself to not focus on the destination, otherwise I'll miss out on the splendor that is the journey.