Variable syntax is finally sane

Published February 27, 2012
Advertisement
At long last, the Epoch syntax for defining and initializing variables has gotten some love.

Here's how R12 Epoch looks:

add : integer a, integer b -> integer c = a + b

entrypoint :
{
integer forty = 40
integer two = 2
integer the_answer = add(forty, two)
debugwritestring(cast(string, the_answer))
}



I plan to kill debugwritestring forever in an upcoming checkin, so be prepared to start writing "print" instead. It will also feature overloads for printing integers, reals, and booleans directly, so you don't have to manually cast them all over the place.

From there, it's just a matter of rebuilding a lot of compiler polish-work so that things like sensible error generation become possible. I'll also need to do some hefty work on the compiler test suite to make sure that all the syntactic and semantic corner cases are covered and well-tested, which should help alleviate some of those stupid situations where I ship a release with half the examples busted.


In other news, it's difficult to restrain myself from heading off on a rabbit trail and starting to work on native code generation via LLVM. In fact, screw it, I might just start working on that in parallel with the compiler rewrite, and push back R12 a bit. I dunno.


Maybe this nice bottle of scotch will tell me what I should do...
1 likes 1 comments

Comments

Washu
Scotch always lies to me. Saki never does.
February 27, 2012 04:39 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement