Today mainly saw development work on my game-oriented scripting language, GameScribe. This is mainly because after a nice lengthy Computer Science assignment in Scheme, my mind refused to go back to Membrane Massacre. Better name still pending.
Feature-wise, I implemented both single-line and multi-line comments, the latter supporting nesting. Normal Scheme (which the language is modeled after) only supports single-line comments (via ;'s), but I'm a fellow who likes his multi-line comments. Here's what a sample script looks like with them:
!..... Program: First GameScribe script ever... Author: Stephen Whitmore.. Purpose: To show (hopefully!) that the GameScribe interpreter works :)!. Aaaah! Nested! .!...!(define a (+ 9 10))(define b a)(define say_hello "Hello world!")(print a ", " b)(print (+ a b))(print (<= (pow a 5) (* 2 b))) ;; This line isn't confusing. At all!(print "This concludes the first ever GameScribe script. (" say_hello ")")(print);; Whew, all done!
Nothing that fancy. I'm sure "!." and ".!" look weird as comment header/footers, so I'm open to ideas.
Additionally, several nastier bugs were cleaned up. One of which is that I was sillily (word?) forgetting to recursively identify identifiers (read: unknown 'token' in the script) recursively, meaning if I had "(define a 12)" and "(define b a)" and wrote "(print b)" it would spit out "$a", which is the notation for some unknown identifier. With that, it seems that running scripts from disk works just fine now.
The other burden was getting some in-source documenting done. My last clean-up session was making the interpreter object-oriented, and today's fun was no less exciting. [smile] As a result though, I've refamiliarized myself with the code again, and fixed some inconsistancies.
Next on the list is user-defined functions, and proper variable scope. I've decided not to implement functions like Scheme does (as lists, technically), or even have true lambdas. Functionality > complexity for this scripting language. [smile]
Despite the dry tone of this entry, I'm actually really excited about GameScribe. (I blame the tiredness!) Writing your own programming language is a really fun exercise that I recommend to anyone willing to give it a shot. I think just about every programmer who is here has wanted to make their own language their way. I urge you to do so -- it's certainly worth it!