🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Running Thoughts

Published August 07, 2008
Advertisement
12:50 AM
I wasn't even planning on working on Epoch tonight. In fact, I was planning to go to bed and get some much-needed sleep. But after a few minutes of lying around in the dark, thinking up things I could be implementing in the Fugue VM, I decided what the hell, what's a couple of minutes? I'll hack up some stuff, maybe half an hour or so, then go to bed.

That was two hours ago.


I've currently hacked myself into a corner. I've changed the syntax of function definitions a bit, and I'm working on implementing support for multiple return values from a function. (This will essentially create an anonymous tuple type with named members for each return value; for now I just want to get it working with single returns.)

So far this has gone well, but there's one major problem: the parser is doing something out of order, and the definition of the return type is getting lost in the shuffle.

It's time to break out some caffiene and the debuggery hat, and dig into what exactly is going on.


1:03 AM
Bug caught and squished; turns out I was setting a pointer to NULL prematurely, thus obliterating the information I needed. Moving the pointer-clearing operation to the correct phase of the parser fixes the issue.

In the process, I nabbed another bug related to incorrect parsing of integer literals; they were being misidentified as reals. This is easy enough to fix by having the grammar require the presence of a "." to treat a number as a real.


1:14 AM
One bug down, but another pops up to take its place - this time, there's an issue with the return value variables not getting bound in the function scope correctly. (Don't worry if that made no sense.)

Turns out I just needed to do a clean rebuild of the project, and everything's back to running smoothly.

Function calls now look like this:
pi : () -> (real(retval, 0.0))
quuxfunction : (integer(var)) -> (integer(ret, 0))

This makes the syntax much more consistent with the variable-definition syntax, which is of course:
integer(foovar, 42)

I like this because consistency and simple syntax are one of my big priorities; I don't want to end up with a beast like C++ where you have to remember thirty billion syntax rules for every little edge case and variation.


1:25 AM
Discovered yet another interesting bug: when the same function is invoked multiple times, its local variables are not reset. This means that every time the function is called, the old values of the variables stay in memory. Obviously, my implementation of lexical scoping is faulty.

At this point, despite the largely-empty can of Amp in front of me, I'm pretty exhausted. I can barely type legibly.


So instead of fixing this problem, I'm off to bed. It's been an adventurous night - not quite as exciting as I'd hoped, but at least forward progress continues to be made.
0 likes 2 comments

Comments

evolutional
Do you have a site for Epoch? I'd lpve to see a list of features/etc you're adding/working on as well as a current version to play with.
August 07, 2008 01:56 PM
ApochPiQ
I did at one time, but I've let the domain lapse and I haven't been bothered to renew it. I'll seriously consider posting a full site eventually, but for now I'll most likely just host something small here on GDNet.

In fact, that's a great idea for something I can whip together and count it as work on Epoch, but without having to mess with the VM [grin]
August 07, 2008 02:15 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement