Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

Variable syntax is finally sane

Posted by , 26 February 2012 · 887 views

Epoch Syntax
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...

Scotch always lies to me. Saki never does.

January 2017 »

22 232425262728